Questions tagged [openlayers]

OpenLayers is an open source Javascript web mapping library for creating web map applications.

OpenLayers is a JavaScript library which implements an API for developing dynamic map widgets on the web. The library provides tools for presenting and editing geographic information using pure JavaScript with no server-side dependencies.

OpenLayers supports several different access methods for geographic data, including the OpenGIS Web Mapping Service (WMS) and Web Feature Service (WFS) protocols from the Open Geospatial Consortium. Other supported geographic data sources include OpenStreetMap, Bing Maps, and ArcGIS Server. See the OpenLayers live examples page or the documentation for more comprehensive details.

OpenLayers is a project of the Open Source Geospatial Foundation (OSGeo) and is released under a BSD-style license (also known as the BSD-2-clause).

Books

OpenLayers Cookbook

Tag Usage

When asking a question with the tag, please mention the OpenLayers version you are using - especially for coding related questions.

5064 questions
17
votes
7 answers

how to hide vector features in openlayers

I have written some code to hide specific markers in our maps based on checkboxes outside of the map itself. However, these markers also have vector features too (really on separate layers) but I want to just hide the features rather than destroy…
Andrew Christensen
  • 369
  • 2
  • 4
  • 9
17
votes
2 answers

Saving and restoring geometries in OpenLayers

Context: I'm a just-hours-old newbie at OpenLayers, please be gentle. Fundamentally, I have a map with some drawn objects on it. If I understand things correctly, I have a number of OpenLayer.Feature.Vector (layers?) with a number of…
Walt Stoneburner
  • 2,562
  • 4
  • 24
  • 37
17
votes
1 answer

Integrating React and OpenLayers within a Redux Architecture

We're currently working on a new web mapping solution at our company. So far we decided to build the app using React and OpenLayers 4. Since we want to use the Redux pattern for our architecture there will be one redux store holding the application…
TobsenB
  • 333
  • 1
  • 11
17
votes
3 answers

OpenLayers: disable zooming on double-click

OpenLayers, by default, zooms in when a user double clicks a map. What is the best way to disable this behavior?
Ovesh
  • 5,209
  • 11
  • 53
  • 73
16
votes
3 answers

How to get the current viewport of the map out of OpenLayers as geometry, bounding box or wkt?

I'm trying to find some hints where I should search for this topic but I've nothing found - and I spent many hours on this. I'm also trying to get the current coordinates out of the current displayed viewport from the OpenLayers map to add only…
Patrick Hillert
  • 2,309
  • 4
  • 22
  • 37
16
votes
5 answers

OpenLayers script available in CDN?

Is the OpenLayers Js script available in a CDN somewhere - in a minified version? I don't want to load it from their website, that would be to slow and not nice.
Marc
  • 6,749
  • 9
  • 47
  • 78
16
votes
3 answers

How to transform a distance from degrees to metres?

I'm using OpenLayers with an ordinary mercator map and I'm trying to sample a bounding box by finding a grid of points in latlong. The bbox is expressed in latlon, e.g. 48.1388,-15.3616,55.2057,-3.9359 I can define a distance in degrees (e.g. x:…
Mulone
  • 3,603
  • 9
  • 47
  • 69
16
votes
3 answers

Use SVG icon as marker in OpenLayers

I tried to svg icon as marker in Openlayers-3. Here in my code. var svg = '' + '' + '' …
16
votes
3 answers

Adding event handler to feature in OpenLayers 3?

I am using the following code to add a feature to a vector layer in OpenLayers 3 (OL3): marker = new ol.Feature({ geometry: new ol.geom.Point([longitude, latitude]), name: "Location Marker" }); markerStyle = new ol.style.Style({ image: new…
ProfNimrod
  • 4,142
  • 2
  • 35
  • 54
16
votes
1 answer

How to read external GeoJSON file from openlayers?

I have to draw some lines by OpenLayers. The line features are coded as GeoJSON format. My code is ok for hard coded GeoJSON features. But, if I put this features in separate file and try to load it. It just does not work. I do not know what is the…
Shahjalal
  • 1,163
  • 7
  • 21
  • 38
15
votes
4 answers

Draw line between two points using OpenLayers

I have two points having lolLat as 0,10 and 30,0 Now to draw a marker at this point i use this transform while generating marker for it lonLat.transform( new OpenLayers.Projection("EPSG:4326"), // transform from WGS 1984 …
RPB
  • 16,006
  • 16
  • 55
  • 79
15
votes
4 answers

How can I remove standard controls in an OpenLayers-Map?

I use OpenLayers and want to create another navigation-control in the upper-left side. I know how to add Controls, but this navigation is added at default while creating the OpenLayers-Map. So I want to remove that Control, to add an own. I know…
Mnementh
  • 50,487
  • 48
  • 148
  • 202
14
votes
8 answers

mapquest direct tile access discontinued

As of today 2016-07-11, MapQuest has discontinued direct access to their tiles. They seem to only support Leaflet, iOS and Android SDKs. Any idea how to get Openlayers to work with MapQuest again, or should we be thinking of a different alternative?…
Thien Pham
  • 157
  • 1
  • 1
  • 4
14
votes
2 answers

node.js and geoserver CORS

I have node.js server 0.10.12 and express.js 4.8.5. Node.js is the web server, includes openlayers 3.9.0. Geoserver 2.1.3 serves the WMS layer. Later, I will implement vector layers. There is only one route (for the index page) var routes =…
slevin
  • 4,166
  • 20
  • 69
  • 129
14
votes
1 answer

Rendering spatial data of GeoQuerySet in a custom view on GeoDjango

I have just started my first project on GeoDjango. As a matter of fact, with GeoDjango powered Admin application we all have a great possibility to view/edit spatial data, associated with the current object. The problem is that after the objects…
Dmitry Lebedev
  • 268
  • 1
  • 3
  • 11