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
0
votes
0answers
26 views

Is project more Leaflet or OpenLayers or Map Server friendly? [duplicate]

I have several tables in a database on PostGIS. I want to create a website where the users can log-in, show the layers they want and filter the elements of the layers based on the fields of the ...
0
votes
0answers
16 views

Parsing shapefile and showing features on map [closed]

I would like to read shapefile then parse it and add features from files to map. Does anyone solve that kind of issue? I need some suggestions. For parsing, I have used the shapefile library, it ...
1
vote
1answer
18 views

OpenLayers select.on event listener fires multiple times (renders multiple)

I am using hook React My question is to render event only once instead multiple times useless When I am selecting a feature, it renders multiple times var select = new ol.interaction.Select(); ...
0
votes
0answers
11 views

Geoserver rest api CORS policy: No 'Access-Control-Allow-Origin' header issue , in React [duplicate]

I would like to fetch data from React to GeoServer rest/API, however, it gives me that error: blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource I ...
2
votes
1answer
45 views

Resizing Map width and height (avoid distortion)

I am working with OpenLayers library on React My first question is how to avoid distortion while resizing map width and height, The second issue is when I am changing with/height each time it ...
1
vote
0answers
19 views

OpenLayers zoom selected feature

In our OpenLayer.js we first call the maximum extent of the map: "maxExtent: new OpenLayers.Bounds (X1, Y1, X2, Y2),". After the layer definition follows "map.addLayers ([lyr1, layer3, layer4]);" ...
1
vote
1answer
19 views

Getting strange exception since switching to GeoServer 2.16 from 2.8 with WFS queries in OpenLayers 2

Here is the error in the GeoServer log (as it is returned to the caller): 2019-10-28 17:03:59,021 INFO [geoserver.wfs] - Request: getServiceInfo 2019-10-28 17:03:59,053 ERROR [geoserver.ows] - ...
1
vote
0answers
26 views

Migration from ol2 to ol6 fixed strategy missing

I try to migrate from ol2 to ol6. My ol2 uses OpenLayers.Strategy abstract class with Fixed() and BBOX members: var strategy = layerData.Strategy == "fixed" ? new OpenLayers.Strategy.Fixed() : new ...
0
votes
0answers
76 views

How to add map.addControl, WMSLegend in OpenLayers 2

I am trying to get the categorized symbology for a single WMS layer in the layer switcher. See my code below (I am getting error OpenLayers.Control.WMSLegend is not a constructor) My OpenLayers ...
0
votes
0answers
46 views

Unable to preventDefault inside passive event listener due to target being treated as passive: Openlayers 2

I am getting the following error messages: How do I define add control and prevent passive event listener? Below is the code: <!DOCTYPE html> <html lang='en'> <head> <meta ...
1
vote
0answers
47 views

No GetFeatureInfo response when clicking on a map in OpenLayers 2

I have the code below, however no response when clicking on the map. <!DOCTYPE html> <html lang='en'> <head> <meta charset='utf-8' /> <title>My OpenLayers Map</...
1
vote
0answers
46 views

Uncaught Reference Error: init is not defined

I am getting the above error on my HTML file @ line number 22. I tried several attempts and was unable to resolve it. Here is the HTML code: <!DOCTYPE html> <html lang="en"> <head&...
0
votes
1answer
35 views

Uncaught Reference Error: OSM is not defined Openlayers 2

I am trying to get the get feature info and popup to function. Currently, I face the above error. Not sure how to define OSM because all layers were loading fine before I added the getfeature part of ...
0
votes
0answers
22 views

Attribute query OpenLayers server

As part of the MapServer polygons (district boundaries) are shown on the OpenLayers map. The script is in JavaScript. The polygons contain attributes. Currently, a second window opens with the ...
0
votes
1answer
20 views

Drag Vertices - ol2 Modify Control vs. ol3+ Modify Interaction

In OpenLayers 2, clicking a geometry with an active modify control running, created a drag vertice on every edge of the geometry which could be used to modify the geometry by dragging. In OpenLayers ...
0
votes
0answers
18 views

get Map's Scale in OpenLayers3+

In OpenLayers 2, it was easy to get the current Scale by just calling map.getScale(). Somehow, this disappeared in OpenLayer 3+. How do I get the current Scale then and why did it have to disappear?
0
votes
0answers
23 views

Custom feature labels based on properties

In OpenLayers 2, I used to custom style features based on indirectly referencing variables like style: { label: "${feature_id} ${feature_name}" } where feature_id and feature_name were ...
-2
votes
1answer
46 views

Local coordinates in NoSql database

Is there any nosql database which supports the below 1) Should support local coordinates (spatial data which holds the coordinatesof door, Infra, etc.) 2)Integration with Geoserver.
2
votes
0answers
49 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
15 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
41 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
250 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
47 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
37 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
52 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
43 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
41 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
36 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
53 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
73 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
72 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
28 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
110 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
66 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
41 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
48 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
66 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
48 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
46 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
134 views

Problems opening MapSurfer layers

Why won't Mapsurfer OSM layers open anymore from the QuickMapServices plugin in QGIS version 3
0
votes
1answer
33 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
32 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
183 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 = ['...
2
votes
1answer
140 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
35 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
31 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
40 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
192 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
200 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
37 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*;...