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
1
vote
1answer
7k views

Adding markers using OpenLayers 4

adding markers works fine using OpenLayers 2 but now I need to add markers using OpenLayers 4, how can I do this? my code as follows: var markers = <?php echo json_encode($data)?>; var ...
-1
votes
1answer
97 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
2answers
258 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) ...
-1
votes
1answer
42 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 ...
2
votes
1answer
7k views

OpenLayers - Show a WMS Layer from GeoServer

I'm trying to acesses with OpenLayers code an example of the embedded GeoServer map (the map of tasmania), which acts as a local server on my machine. However, every time I open the .html, the map ...
4
votes
2answers
643 views

Do Vector-tile file-names need zoom levels and if so, why?

I'm new to mapping and I'm looking to self-host some PBF-based vector tile files, mainly for a hybrid mobile app (Phonegap, HTML5, Openlayers or Mapbox-GL-JS). If I need to generate or pre-render ...
15
votes
7answers
33k views

How do I get the coordinates of a click on vector feature/layer in OpenLayers2?

I need to get the coordinate of the click when the user clicks on a vector feature on the OpenLayers map. The SelectControl only gives the feature that was clicked and not the coordinates of the click....
3
votes
2answers
607 views

GeoJSON data not getting displayed on Openlayers map in Geodjango

I have the following code. models.py class PFT(models.Model): species=models.CharField(max_length=50) geom = models.PointField(srid=4326) objects=models.GeoManager() def __str__(...
0
votes
1answer
104 views

Limiting Google street view to extent on OpenLayers 2?

I would like to be able to limit the Google street view area in my map to to 500m radius from where the panoramic street view starts ( this is where the user clicked the mouse on the map). Is this ...
2
votes
2answers
3k views

Calculating distance between two points using OpenLayers

I don't understand why I have two different results between Openlayers distanceTo () and Movable Type Scripts LatLng : (43, 3) LatLng : (42, 4) OL : 187.6 Movable Type Scripts : 138.1 var ...
1
vote
1answer
358 views

Getting two lat-lon points in JSP to find shortest path on click of OpenLayers map?

I'm using GeoServer, PostgreSQL and here OpenLayers. I'm trying to retrieve two lat-lon points (for point A and point B) on clicking of map. This code is working only to retrieve one lat-lon. I ...
1
vote
2answers
996 views

Removing custom controls?

I am trying to remove custom draw controls from my OpenLayers application which I create like this: var drawControls = { polygon: new OpenLayers.Control.DrawFeature(polygonLayerFreehand, ...
0
votes
1answer
404 views

GetLegendGraphic with bbox or filter

I have geoserver layer with sld style applied. The sld have like 50 rules using type attribute of the feature. Now i need to generate legend but only for specific area (i have bbox coordinates). I am ...
1
vote
1answer
12 views

OpenLayers styling lines between points

I drew a line between two points and would like to change the line styles but currently is not working as expected. Tried to add the style into the features. Am i missing something? var ...
0
votes
0answers
9 views

Use a Customized Set of Roads

Is there a way using Mapbox and OpenStreetStreet maps to display a customized version of roads. I am building a product which provides directions for large equipment. And there are some roads, ...
3
votes
4answers
11k views

Dragging a feature in OpenLayers 3

I'm trying to replicate something that was fairly easy in OpenLayers 2 in OpenLayers 3, which is: dragging an existing feature to a new location on the map. In OpenLayers 2 I just added a DragFeature ...
0
votes
1answer
273 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
108 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
1answer
123 views

Requesting two layers in search action of one PanelForm

I have a panelForm with 4 fields, and a search button, that search for the features that correspond to the 4 fields given by the user. and I have two layers that both contains the 4 fields. after the ...
2
votes
1answer
43 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
votes
1answer
85 views

OpenLayers ArcGIS93Rest symbol size

I'm using OpenLayers 2 to display ESRI WMS data (ArcGIS93Rest layers). The data I'm displaying contains symbols (and sometimes labels) and I'd like to increase the display size of these symbols (...
0
votes
1answer
124 views

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

I'm using the clustering 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} )...
3
votes
2answers
2k views

Lat/long values in a WMS GetFeatureInfo request

I have tried to send manual WMS GetFeatureInfo request to GeoServer with the parameter values X and Y (pixel values) taken from the map object of OpenLayers. I have got the response with the wrong ...
1
vote
1answer
78 views

Creation of buffer area of 20mtrs upon click event on the base layer

I have a base layer upon which i wish to import a kml with certain lat lons and create a buffer region of 20mtrs around any point upon click event. i got google api for the same but want openlayers ...
0
votes
1answer
155 views

OpenLayers.Filter.Comparison value charecter encoding

I am using vector layer with WFS protocol var adressVector = new OpenLayers.Layer.Vector("Adress", { strategies: [new OpenLayers.Strategy.BBOX()], protocol: new OpenLayers.Protocol.WFS({ ...
1
vote
1answer
177 views

OpenLayers feature styling change by the baselayer

How can I have the style of the features on a vector layer depending on the OpenLayers' "base layer"? For example, some base layers are dark images and I need (for the contrast) the features to be ...
16
votes
2answers
35k views

Remove/Delete a feature from OpenLayers vector layer

I have an OpenLayers layer with several vectors on it. I know the OpenLayers Feature ID (e.g. OpenLayers.Feature.Vector_241) and I would like to know how to remove this feature and only this feature? ...
2
votes
0answers
595 views

Detecting start of pinchzoom

I have a function that i want to call when you start pinchzoom on the map. This function turns off all vector layers to improve performance while panning zooming. I got another function that is ...
0
votes
0answers
24 views

Clear the cache in OpenLayers 2

We are using OpenLayers 2 library for displaying custom boundary layers in map. But there is an issue with cacheing, when we do zoom in or zoom out duplicate layers are coming. But this duplicate ...
2
votes
2answers
2k views

OpenLayers: Copy shape layer in a vector layer

I have a web-gis application based on OpenLayers and GeoServer. I need to modify a shape layer. I'm able to show the shape using the OpenLayers.Layer.WMS method. In fact I published the shape in ...
1
vote
1answer
3k views

Measuring on OpenLayers map

These days, I am trying to develop web map using openlayers. I copy source code from here Then I changed code to display my data.B ut it does not work, even map is also not showing. In chrome shows "...
2
votes
2answers
483 views

Control Map Pan per checkbox

I want to add the functionality of switching the option to pan the map and put it in a checkbox. But I'm not quite sure how I can do that. The reason I want to do this is: I have a layer which ...
3
votes
1answer
528 views

Losing Grass tools after openlayers installation in QGIS 2.16 [closed]

QGIS 2.16 is running well until I install the openlayers plugin. Then qgis loses the grass connection. After deactivating or uninstallation everything works fine again.
3
votes
1answer
1k views

Are there any examples of WCS GetCoverage requests done using AJAX?

I am looking through OpenLayers to try to figure out a consistent format for generating views of coverages that can satisfy any WCS server, but mainly I'd like to get GeoServer coverages. While I've ...
0
votes
1answer
122 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: ...
1
vote
0answers
1k views

Code to load TIFF image on openlayer.layer.wms using MapServer MS4W [closed]

Where did I get mess up? Here is my code inside the mapfile.map LAYER NAME "layername" STATUS OFF TYPE RASTER DATA "data/sample.tif" END The code inside explorer.js from where I ...
0
votes
0answers
41 views

How to render map using OpenLayers (5 or 6) from cached tiles?

I am using OpenLayers 2 for rendering map (from PostGIS database) and tilecache for caching map tiles using XML. Now I want to upgrade to a higher version of OpenLayers, for that I want to know a good ...
6
votes
2answers
7k views

openlayers bootstrap3 examples?

I was wondering if there is any good example of openlayers used in the HTML page with bootstrap3? I searched around, and can only find bootstrap 2 examples, like this one: http://dev.openlayers.org/...
0
votes
2answers
2k views

WMS BBOX in URL vs in params

I'm new to OpenLayers and GeoServer and I have a problem (of course :P). I must retrieve a layer from a GeoServer WMS service, and I want to construct the URL to request it. If I try to make this: ...
104
votes
8answers
78k views

Choosing OpenLayers or Leaflet? [closed]

I was debating with one of my collegues on OpenLayers v/s Leaflet. I made a point that OpenLayers is much better API if we wish to build a project, where you need direct connectivity to the Geoserver ...
12
votes
4answers
24k views

Get Center of Geometry in OpenLayers 3

Given a Geometry object in OpenLayers 3. How would one go about getting its center? Older versions of OpenLayers provided a getCentroid method. There was also a getBounds workaround. But these appear ...
0
votes
0answers
26 views

Points disappeared after changing CRS [duplicate]

I'm having a problem with CRS and layers in QGIS & on Geoserver What I'm trying to accomplish to change CRS of layers in importing. I'm importing 'test.geojson' file in QGIS, and when I open ...
7
votes
5answers
20k views

Setting default zoom level in OpenLayers

With your help I was able get a shapefile from the CAD file of the previous question. Now the next step is the display the shapefile in OpenLayers... I wrote the script but the map being displayed ...
1
vote
0answers
62 views

Is there OpenLayers event when reaching bounds?

I have an app using OpenLayers and OpenStreetMap tiles. There are more zoom levels for the capital and less zoom levels for the entire country. Let's say the user is in the capital, in his car, in ...
-1
votes
1answer
508 views

Using Google Maps as base layer with overlays (vector & rasters) in OpenLayers

Currently i'm using OpenLayers 2.12 and geoserver 2.2.4. On initial load the application has the base layer(say baseLayer_1) of 4326 projection with overlay layers of One WMS layer(say worldWms) and ...
9
votes
4answers
17k views

Reprojecting base layers in OpenLayers

I have vector/topo/image tiled maps for some places in North America which were published as ArcGIS Server REST service. These maps (A) are based in EPSG:26912 projection. Now I want to use these as ...
9
votes
5answers
6k views

Using base layer of two different projections (Spherical Mercator and WGS84) in OpenLayers

How do I add baselayer with two different projections? I have added overlayer with a different projection(EPSG:4326), but I need to add base layer with various projection Google Maps My vector ...
2
votes
1answer
404 views

OpenLayers cannot close popup

I am using OpenLayers 2. I have a map with points from GeoJSON file. I created a default style and a select style for these points. I created a popup with attributes from GeoJSON when clicking on a ...
2
votes
0answers
953 views

Plotting heatmap/locations in GeoServer & OpenLayers map from Lat/Lon data of PostGIS table [closed]

I am using Geoserver, Openlayers, PostGIS for Geospatial web implemenation. I have an Indian map shape files for States, Districts, Talukas. I am able to generate a map with states, districts, ...
9
votes
5answers
11k views

Adding custom map tile layer using QGIS?

I am trying to display the following background map in QGIS 2.0: http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/${z}/${y}/${x}. In a custom web map client, this is ...

1
2 3 4 5
66