Questions tagged [openlayers-3]

OpenLayers 3 is the complete rewrite of the OpenLayers 2.x mapping library, targeting modern features of HTML5 and CSS3. It is not compatible with OpenLayers 2. OpenLayers is completely free and open source, having been released under the 2-clause BSD License.

OpenLayers 3

OpenLayers 3 is a high-performance, feature-packed library for creating interactive maps on the web.

Beginners may wish to consult the following resources:

Usual search keywords are 'OpenLayers' and 'ol'.

Source code can be found on GitHub at https://github.com/openlayers/openlayers.

Tag usage

Use of the tag was encouraged by OpenLayers developers for questions specific to OpenLayers 3, but it no longer is. The tag will probably get more attention.

2413 questions
5
votes
1 answer

How to get a reference to the modified feature in openlayers 3

Using OpenLayers 3 to modify features, how do I get the modified feature? var features = new ol.Collection(editableLayer.getSource().getFeatures()); var modifyInteraction = new ol.interaction.Modify({ features:…
Robert Smith
  • 779
  • 1
  • 10
  • 28
5
votes
1 answer

Feature ID's in OpenLayers 3 are undefined

In OL2 feature id's were generated internally. In OL3 this doesn't seem to be the case since the id's are undefined. I have tried with WKT, JSON, and KML sources and none of them have id's assigned to features. Has the internal feature id been…
MoreScratch
  • 2,933
  • 6
  • 34
  • 65
5
votes
0 answers

React Native – multiplatform equivalent of OpenLayers for static images

I'm building a React Native app for iOS and Android. Our web-based prototype uses OpenLayers 3 to display pins on a static image (rather than a map). In effect, we're using all the map sugar (zooming, panning, and most importantly, marker pins) but…
shankie_san
  • 181
  • 1
  • 12
5
votes
1 answer

Openlayer 3 - check if a feature is within bounds of extent

I have a list of features and a vector layer and I need to know, whether each feature is within the bounds of the view of the map or not. I'm using openlayers v3.9.0 and in the corresponding documentation there is a function containsExtent() (link)…
schub
  • 912
  • 1
  • 8
  • 26
5
votes
1 answer

Open Layers 3 center the map based on extent on vector layer?

I want to position the center and zoom level of my map depending on the vector layer features (points). I have a geojson file which is populating my map: var vectorSource = new ol.source.Vector({ url: 'assets/js/data.geojson', format: new…
Nicolas T
  • 327
  • 1
  • 5
  • 15
5
votes
2 answers

Stacked Lines (or Multilines?) between two Points on Map

I hope that I am in the right place with my concern. I recently made myself some thoughts on how my company software could evolve to get better and noticed on a website a map-based software, which had some kind of "stacked lines" between to points…
Dominik Tamm
  • 158
  • 8
5
votes
2 answers

Is it possible to set different colors to each segment of a LineString without meeting a huge performance hit?

My openlayers 3 application draws several LineString features on the map (from a few dozen up to 2000-3000). When setting different colors for each segment of the LineStrings, I meet a huge performance hit (starting from just a few LineStrings on…
Vinzz
  • 123
  • 1
  • 9
5
votes
1 answer

get the EPSG code from openlayers 3 layer

This is my OSM layer in openlayers 3.9.0. var layer = new ol.layer.Tile({ source: new ol.source.OSM( { attributions: [ new ol.Attribution({ html: 'All maps © ' + '
user2860857
  • 549
  • 3
  • 10
  • 21
5
votes
1 answer

Rule based Styling in openlayers 3

I am trying to do the rule based styling in openlayers 3, here is my code: CONFIG
Rajan
  • 71
  • 1
  • 4
5
votes
2 answers

Openlayers 3 Circle radius in meters

How to get Circle radius in meters May be this is existing question, but i am not getting proper result. I am trying to create Polygon in postgis with same radius & center getting from openlayers circle. To get radius in meters I followed…
Dyapa Srikanth
  • 1,231
  • 2
  • 22
  • 60
5
votes
4 answers

OpenLayers: 'Failed to execute 'toDataURL' on 'HTMLCanvasElement'

I have a problem when I try to export a map with multiple layer created using OpenLayer. This is my JS code: map.once('postcompose', function(event) { var img = new Image, canvas = event.context.canvas; img.crossOrigin =…
neoben
  • 743
  • 12
  • 30
5
votes
1 answer

How to offset ol.style.Circle or ol.style.RegularShape?

It is possible to define an offset for ol.style.Text instances (offsetX and offsetY properties) and define a custom anchor for ol.style.Icon instances. This functionality is not present neither in ol.style.Circle nor ol.style.RegularShape. I need to…
Peter Kovac
  • 2,257
  • 1
  • 19
  • 18
5
votes
3 answers

OL3: how to modify selected feature style based on zoom?

I use the following code to modify the radius of a Circle marker based on the zoom level: //add the layer to the map map.addLayer(vectorLayer); //add selection interactivity, using the default OL3 style var select = new…
bramb84
  • 355
  • 4
  • 14
5
votes
1 answer

How do I dynamically load GeoJSON data, based on the map extent, into my OpenLayers 3.5.0 map layer?

I am migrating from OpenLayers 3.2.0 to 3.5.0 and am having trouble loading my GeoJSON data into my vector layer. I have it working, but I'm transforming the geometry of the features from my GeoJSON data source before I add them to my vector…
Miles
  • 1,561
  • 1
  • 15
  • 22
5
votes
2 answers

Update or destroy popup in openlayers3

I try to build a map with openlayers3 with a group of markers and popups. The markers and the popups work so far, but when I click on one marker (popup shown) and then -without clicking in the map again- on another one, it shows a popup with the…
however
  • 51
  • 1
  • 3