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
8
votes
2 answers

GeoJSON: Are Properties allowed in FeatureCollection?

I could not find any relevant information in the spec: http://geojson.org/geojson-spec.html Is it allowed to have a properties key in a FeatureCollection? Or is it only possible for Features? If it's possible, how can I access the properties within…
jllodra
  • 1,348
  • 1
  • 14
  • 22
8
votes
1 answer

How do I interact with WMS tile layer served by GeoServer using Vuelayers?

I'm developing a web mapping application using the Vuelayers library which is Web map Vue components with the power of OpenLayers. I have the following code in my template:
Boussadjra Brahim
  • 82,684
  • 19
  • 144
  • 164
8
votes
1 answer

Preventing 'Unable to preventDefault inside passive event listener' error within Chrome & OpenLayers 2

I use OpenLayers2 (v2.12) to load and generate a map in the user's browser. Recently, Chrome has released an update so that now when I use my mousewheel to zoom in and out of the OpenLayers map, it also causes the whole page to scroll up and…
LukeOr
  • 83
  • 1
  • 1
  • 4
8
votes
2 answers

How to add a marker to OpenLayers map?

I want to show OpenStreetMap in my web site using OpenLayers library. I want to add a marker but the marker does not show up on the map. I had searched on Google, I had found one code as below my code. There are much examples to add marker but it…
M. Fitriawan
  • 93
  • 1
  • 1
  • 6
8
votes
2 answers

Adding a absolutely-positioned DIV to the bottom of an OpenLayers Map?

I'm trying to position a static image legend in the bottom-right corner of an OpenLayers map on top of the map. I've tried with an absolutely positioned DIV, but it tends to get bumped around by other objects (even with a high z-index). Is there a…
Chris
  • 417
  • 1
  • 6
  • 14
8
votes
5 answers

performance difference between openlayers, decarta and google maps

We have recently been transitioning our company mapping system from Google map, first to deCarta and then to OpenLayers. We have found that OpenLayers and deCarta are remarkably slower than Google Maps when many elements (several thousand) are added…
Andrew Christensen
  • 301
  • 1
  • 3
  • 4
8
votes
1 answer

Cannot get the openlayers css in angular

I just started using openlayers 5 in my angular 6 and I follow this tutorial and also looking this SO question. My angular component right now has import ol-map from 'ol/map'; import ol-xyz from 'ol/source/xyz'; import ol-tile from…
codebot
  • 517
  • 8
  • 29
  • 55
8
votes
2 answers

How to style points in openlayers 4

I'm trying to style points in a vector source in OpenLayers 4. I've defined a style: var pStyle = new ol.style.Style({ stroke: new ol.style.Stroke({ width: 6, color: [255, 0, 0, 1] }) }); and added the style in the…
und
  • 81
  • 1
  • 1
  • 2
8
votes
2 answers

How to display ESRI Vector base map in Openlayers 3

I am trying to add the new ESRI Vector Basemaps in OpenLayers 3. I have gotten so far as to display the layer un-styled by modifying the Mapbox Example published by OpenLayers. Clearly I had to remove the style: createMapboxStreetsV6Style() option…
Shaunak
  • 17,377
  • 5
  • 53
  • 84
8
votes
1 answer

how to get coordinates of a polygon in OpenLayers

I have been looking for how to determine coordinates of the points which consist a polygon(feature) in OpenLayers. Let's say I have created a polygon like the one in this example. I need to know the points which consist the polygon, so I can save…
pars
  • 3,700
  • 7
  • 38
  • 57
8
votes
6 answers

How to add Google basemaps in openlayers-3?

In openlayers-2, we can add google basemaps(satellite,physical,hybrid,etc.). I need to add google basemaps in openlayer-3. How can I add google basemaps??? CODE in openlayers-3 map = new ol.Map({ layers: [ new ol.layer.Group({ …
shrestha
  • 243
  • 1
  • 4
  • 13
8
votes
5 answers

Javascript OpenLayers before zoom event listener

I am trying to set up OpenLayers to not display the vector layer just before a zoom starts and make it reappear after a zoom ends. I have the zoom ends part already established like this: map = new OpenLayers.Map('map_element', { eventListeners: {…
renosis
  • 2,702
  • 2
  • 19
  • 22
8
votes
3 answers

Javascript "unspecified error" in Open Layers

I am getting this error alt text http://img239.imageshack.us/img239/6936/jserror.png when the map loads. The error is in the original, unmodified OpenLayers.js file on this line: return!!(document.namespaces); I have tried rewriting it to: return…
Alin
  • 171
  • 1
  • 7
7
votes
1 answer

Openlayers style the CSS feature popup

Might anyone know of a way to style the CSS of a popup used in Openlayers? Using an OL popup method, returned is a div with an ID of Would I just add that to my CSS and style, or might there be a better way?
user1040259
  • 6,369
  • 13
  • 44
  • 62
7
votes
1 answer

How to draw horizontal lines in openLayers?

I am using openlayers and able to draw lines using DrawFeature and OpenLayers.Handler.Path. Now I need to provide an option to be able to draw horizontal/vertical lines. Which means when the user starts drawing line and moves the mouse to an angle,…
user731918
  • 133
  • 6