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.

4405 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,397
  • 4
  • 21
  • 36
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,535
  • 9
  • 43
  • 75
16
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
  • 293
  • 1
  • 7
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
  • 3,722
  • 1
  • 26
  • 44
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,093
  • 7
  • 19
  • 36
15
votes
2 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
  • 14,846
  • 15
  • 49
  • 78
15
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,433
  • 8
  • 42
  • 66
15
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
  • 4,831
  • 9
  • 49
  • 69
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
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
  • 3
  • 11
14
votes
2 answers

Firefox window.controllers is deprecated. Do not use it for UA detection

My website works in Chrome, IE, and Safari, but when I load it in Firefox, Firefox complains saying "window.controllers is deprecated. Do not use it for UA detection." This code is in the OpenLayers API (OpenLayers 2, latest version), so I can't…
user3148225
  • 396
  • 1
  • 3
  • 14
14
votes
1 answer

TypeError: float() argument must be a string or a number in Django distance

I tried to get the value from my template which is kmdistance but it returns an error when I view the page. Here's the views.py def display_maps(request): #bases for city proper pnt =…
Sachi Tekina
  • 1,662
  • 5
  • 25
  • 47
14
votes
4 answers

How do Bounds work in OpenLayers 3?

Does the concept of OpenLayers.Bounds from OpenLayers 2.x still exist in OpenLayers 3? How has it changed, and what is its new name?
colllin
  • 8,586
  • 9
  • 44
  • 61
13
votes
1 answer

How to select a feature programmatically on a vector layer in OpenLayers?

I'm currently searching for a solution to select (or highlight) a vector in a OpenLayers.Layer.Vector. I've build a simple gridtable where a user can pick a vector (given as WKT formatted string) which should highlight the corresponding vector on…
Patrick Hillert
  • 1,849
  • 3
  • 20
  • 34