Questions tagged [openlayers-2]

Use this tag when you are using version 2.x of the OpenLayers JavaScript client toolkit.

Filter by
Sorted by
Tagged with
2
votes
0answers
37 views

Shapefile or GeoJSON? [closed]

I'm interested in understanding the relative merits of using GeoJSON or shapefile formats for handling geo-spatial data, particularly in an open-source, Python (CKAN project), web-development context. ...
1
vote
0answers
14 views

Zoom to a selected feature with Openlayers 2

var cen = new OpenLayers.LonLat(lng,lat) .transform(proj, map.getProjectionObject()); map.setCenter(cen,30); I need to zoom into the feature selected.
0
votes
0answers
34 views

OpenLayers 2.13.1 WMSGetFeatureInfo not working on mobile

I'm using OpenLayers in version 2.13.1. On desktops everything is OK, alert is showing when I click on route. But on mobiles it is not working, probably touch event is not triggered. var infoControl =...
0
votes
0answers
27 views

How to render values onClick() event in componentDidMount()

I am using OpenLayer library and I need change values in ComponentDidMount() but when I am clicking it does not affect. I have used forceUpdate(). handleDisable = () => { this.setState({ ...
0
votes
1answer
31 views

How to change tileSize in XYZ from default([256,256]) to something else for openlayers?

I am trying to change the tile size and I have not been able. Below is the code. var projection = get('EPSG:4326'); local_url = 'assets/tile/{z}/{x}/{y}.png'; map = new Map({ target: 'map', ...
0
votes
0answers
20 views

Conversion from DXF to SVG

I want to convert a file from DXF to SVG and for that I am writing a python script. However, While converting from DXF to SVG there are certain features that are different such as xOffset, yOffset, ...
1
vote
2answers
51 views

zoom set to 4 but on get zoom shows zero ,OpenLayers

var map1 = new OpenLayers.Map('firstmap'); var wms1; var state1="<%=state%>"; var cql_filter1="st_nm='"+state1+ "'"; wms1 = new OpenLayers.Layer.WMS( "OpenLayers WMS", "http://localhost:...
0
votes
0answers
35 views

Set center and zoom after CQL filter

I need to display map on the submenu li click with CQL filter which works for me but map displayed is as shown in screenshot. I am unable to adjust its center and zoom. var map = new OpenLayers.Map('...
0
votes
0answers
20 views

Get xy coordinates from latitude and longitude in OpenLayers 2

I'm trying to get the XY on layer but the values are wrong; the lat lon values are correct. I need to convert lat/lon to xy values with OpenLayers 2.
0
votes
0answers
30 views

How to get the color of pixel openlayes 2?

I'm trying to get the color of the pixel from the map in Openlayers 2. Or is there is a function to get xyz values from rgb?
0
votes
1answer
22 views

Style OpenLayers.Feature.Vector in OpenLayers.Strategy.Cluster()

I'm using the clastering feature in my project. I collect list of points like so: cluster_features.push(new OpenLayers.Feature.Vector( new OpenLayers.Geometry.Point(lon,lat), {heading:deg} )...
0
votes
1answer
56 views

Loading a GPX file using OpenLayers 2

I am trying to read a gpx file and add it as a layer to Open Layers. Here is my code snippet osMap = new OpenLayers.Map({ div: "map", maxExtent: extent, resolutions: ...
2
votes
3answers
50 views

Using Proj4js with OpenLayers to transform lat lng from 4326 to 27700 but coming out unchanged

Using Proj4js to transform lat lng from 4326 to 27700 but coming out unchanged. I am using OpenLayers 2.12 (OS API Leisure map) EPSG 27700, Proj4js (CDN) I have added the definition to proj4 ...
0
votes
0answers
22 views

Show coordinate in OpenLayers 2?

I want to show coordinate of every point in OSM. I am using OpenLayers 2. The below code is not working and does not show any error in the console. What is wrong with that code? var popup = Ext....
0
votes
0answers
50 views

setStyle() throws assertion error 41. https://openlayers.org/en/latest/doc/errors

I am trying to set the style of open layer by passing in an object but it is throwing error and when object is passed in an array then it works. Why isn't it letting me pass an object? The code below ...
0
votes
0answers
57 views

How to import a GeoJSON file from GeoServer using OpenLayers

I have been trying to import the layer that I created in GeoServer. I need to use OpenLayers. This is what I have so far. <!-- language: js --> <script type="text/javascript"> var ...
0
votes
0answers
39 views

White boxes instead of tiles on Map

I am trying to solve this problem for quite sometime without any luck. When I minimize the browser after the map is loaded some part of the tiles goes missing and instead I see white space. There are ...
0
votes
0answers
39 views

OpenLayers 2 increase timeout for WPS call

I am calling a WPS process with OpenLayers 2 (I know it is deprecated). I use the function OpenLayers.Request.POST and post an XML file. This works fine for "normal" requests. But I also need to call ...
0
votes
1answer
34 views

Request a Ajax with GET to remove one or more geometries in OpenLayers

I have a html selection of the form: <table class="table"> <tr> <td> <label>Afiseaza:</label><br /> <select id="layer" onchange=...
0
votes
1answer
37 views

Loading GeoJSON by AJAX method in OpenLayers, centering the map automatically

I'm trying to center the map on the geometries that are on the map. To encompass all but until now I have not succeeded in how ... It centers further than geometries :( if (ol.proj.proj4 &&...
0
votes
0answers
37 views

OpenLayers 2 - prevent self-intersecting polygon [duplicate]

OpenLayers 2: How can I detect whether a polygon (or linear Ring) is self-intersecting and how can I prevent that?
0
votes
1answer
107 views

Problems opening MapSurfer layers

Why won't Mapsurfer OSM layers open anymore from the QuickMapServices plugin in QGIS version 3
0
votes
1answer
26 views

Error 43 using openlayers, Geoserver, and WMTS

When attempting to use the WMTS tile service with Geoserver and openlayers I keep getting error 43 (Expected layers to be an array or an ol.Collection.). I am new to openlayers so the issue is likely ...
0
votes
1answer
29 views

OpenLayers. External ArcGISCache layer has different zoom levels/scales than current map in use

Current map has 40 zoom levels. Map uses mostly internal layers but for this one special layer an external service is used and that is where ArcGISCache comes in. This ArcGISCache layer has its layer ...
1
vote
1answer
124 views

OpenLayers: How can I add multiple KML files to the same vector layer?

I'm trying to add some KML files to a vector layer using this code: var map = new OpenLayers.Map('map'); map.addLayer(new OpenLayers.Layer.OSM()); var kml = ['...
1
vote
1answer
80 views

Detecting click on map outside features in OpenLayers 2?

How to detect click on map outside features from two vector layers in OpenLayers 2? Here is a code that alerts on selecting feature: var layer1 = new OpenLayers.Layer.Vector("Vector Layer 1"); var ...
0
votes
1answer
30 views

Why is this happening? I show GeoJSON some coordinates with OpenLayers by request Ajax

I want to display a GeoJSON on OpenLayers with a request from Ajax from the database: I store in the geojson variable all the information and I icercated in two ways: 1. Directly from the already ...
0
votes
0answers
28 views

Complicated vector layer's style in OpenLayer 2

Is it possible to style vector layer so there would be picture and label with its own background color for a feature? Something like this:
3
votes
0answers
35 views

Testing a GeoServer “Scrolling” performance

I'm looking for a way to test the responsiveness of various layers when scrolling around the map. So after a layer is loaded and the user is moving around the map looking a specific area or whatever. ...
0
votes
2answers
141 views

OpenLayers - order of layering from a KML file

I have a set of KML files hosted on a webserver, which two applications use; one uses OpenLayers and one uses Google Maps. The problem is the order they render the KML. Google Maps (and Google Earth) ...
0
votes
1answer
128 views

Temporarily disable drag pan of map

I want to disable an OpenLayer map's draw pan during activation of a DrawFeature Control. What I am trying to do so far, is overwriting the dragstart method of OpenLayers.Handler.Drag.prototype in the ...
0
votes
0answers
34 views

Is it possible to set maxResolution for a layer after layer creation in OpenLayers 2?

var OsmLayer = new OpenLayers.Layer.OSM({ isBaseLayer: true }); _map.addLayer(OsmLayer); I tried, _map.layers[0].maxResolution = *some value*; & _map.baseLayer.maxResolution = *some value*;...
1
vote
1answer
214 views

Truncate coordinates (LonLat) to decimal precision

For example if coordinates are 17.12345678, -82.12345678, and I want to convert them to 3 decimal digits. Expected result: 17.123, -82.123 Is there any API in OpenLayers 2 to truncate coordinates (...
0
votes
1answer
84 views

GeoServer get native SRS of layer

I want to get the native SRS/EPSG-Code of a layer deployed in GeoServer. Maybe similar to this solution: https://stackoverflow.com/questions/32766126/get-the-epsg-code-from-openlayers-3-layer but with ...
1
vote
0answers
35 views

Openlayers 2: [In Touch] Pinch zoom action triggers click event at the end. How to prevent click on pinch zoom

Openlayers 2: [In Touch] Pinch zoom action triggers click event at the end. How to prevent click event registered on map getting triggered when pinch is done
1
vote
1answer
243 views

Openlayers get list of all layers in Geoserver

How can I get a list of all layers deployed in Geoserver separated by Vector/Raster? Similar to how Geoserver itself does this when one uses the WPS Request Builder (it then shows a complete list of ...
0
votes
1answer
26 views

Triggering Events on Drawing Geometries

Which events are triggered when I draw, for example, a polygon? Like when I define the vertices of the polygon by clicking? And how can I capture these events? Or, better: Is there any documentation ...
1
vote
0answers
18 views

Open Layers squished tiles until page zoomed

Upon initial load the map tiles are squished or sometimes do not appear properly as per image below. This is fixed when the page is zoomed in and out (not the map). This is when the page is viewed on ...
1
vote
0answers
73 views

Dynamic colouring of SVG-icons in OpenLayers 2

I've got an OpenLayers 2 map with a lot of point features that need to be represented using a number of different SVG-symbols. Unfortunately, the marker icons need to be displayed in different ...
0
votes
1answer
30 views

scale line distance openlayers 2

Is there a control in Openlayers 2 to show scale similar to the new Openlayers v3/4/5 which displays in ft or miles depending on zoom level? Eventually I will rewrite in OL5, but I'm maintaining ...
0
votes
1answer
66 views

Locating Basemaps in QGIS?

I've been attempting to download a usable basemap for USGS Topography for quite some time. Going through the USGS procedure to acquire the map has not worked to date. Quickmapservices and Openlayer ...
0
votes
0answers
21 views

OpenLayers 2 - Swap lines on deeper zoom for view port

Having two linestrings, one with overview path, which uses less points and draws incomplete line - Overview path. And then a detailed one where it loads a lot of points for correct route simulation. ...
0
votes
1answer
97 views

How realistic is it to be able to build a dynamic map with ~50k points that change colour depending on supplied data? [closed]

I'm a programmer, but I'm new to GIS. I want to build a map that displays the status of some IoT devices I work with. My ideal vision is a world map, which would fill the screen, but for now, ...
1
vote
2answers
242 views

Adding multiple layers in GeoServer WMS URL

I have a URL that I am passing into an API call to bring back a static image of a map. This URL currently works: http://computername:8080/geoserver/Packt/wms?service=WMS&version=1.1.0&...
2
votes
1answer
8k views

Google maps error in OpenLayers plugin in QGIS

I was using the Google maps on OpenLayers plugin in QGIS 2.16.3 successfully before but today when I tried it the page appears as shown in the figure; I tried re-installing the plugin but this keeps ...
0
votes
1answer
38 views

Openlayers 2 aand Openlayers 3 Code convertion

I have an old Opanlayers 2 application. And I need to convert an Opanlayers3 code to Opnelayers2, but could not. Opanlaysrs 3 Code var epsg = "EPSG:900913"; var projection = ol.proj.get(epsg); ...
0
votes
1answer
193 views

GeoDjango raster field display on Leaflet

In the new Django version support raster field and I follow this manual for GeoDjango raster field and this question for add raster I have built a simple demo. here the code : settings.py postgis ...
1
vote
1answer
479 views

Basic WMTS example with GeoServer and OpenLayers

I want to set up a local WMTS with GeoServer. There are a couple of example data layers such as 'topp:states' which has the EPSG:4326 projection. I'm using the default configuration of GeoServer and ...
1
vote
1answer
145 views

View my osm file content on a layer

I'm trying to use OSM maps in a simple html page, just to learn the bases and evaluate if it will allow us to represent specific data on a map. Our needs are to have a web map of a specific highway ...
1
vote
0answers
41 views

Distance between points not consistent

I have an Openlayers application where I can input a centre point, width and height in meters from which I can generate a bounding box to display on the map. The problem I'm having is calculating the ...