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

Is there a way to disable rotation in OpenLayers 3?

I am currently upgrading my OpenLayers 2 Mapview to OpenLayers 3. I really like the new OpenLayers client, but i wanted to deactivate the ability to rotate the map on mobile devices (rotating with 2 fingers). But I can't find any settings for this.…
Franziskus Karsunke
  • 4,948
  • 3
  • 40
  • 54
12
votes
2 answers

How to get openlayers 3 zoom control to show up on right side?

By default the openlayers 3 zoom controls are on the top left. How can I move it to the top right? The API appears to return a broken link when going into options.
Rolando
  • 58,640
  • 98
  • 266
  • 407
11
votes
2 answers

Openlayers 3: add text label to feature

I have the current set up here: fully functional fiddle example and whilst I have managed to zoom to each polygon feature I would also like to display a centralised text label on each... the field_title variable found within the get_fields method. I…
Helen Danger Burns
  • 421
  • 2
  • 9
  • 28
11
votes
1 answer

Performance test OpenLayers vs Leaflet

I would like to compare the performance between OpenLayers and Leaflet. I want to test things like which is the fastest to render vector files, basemaps, show a massive amount of markers etc. I can set up this examples myself, but I don't how to…
11
votes
2 answers

OpenLayers 3: "movestart" event on map

OpenLayers3 API has a map.on("moveend") , however I cannot find a movestart. Any one know how I can achieve this? Is there a equivalent event? OpenLayers 2 had a movestart event on map. I am looking an exact parallel in OpenLayers3 Here's a basic…
Shaunak
  • 17,377
  • 5
  • 53
  • 84
11
votes
3 answers

How to disable DragPan in OpenLayers 3?

How to disable DragPan interaction in Openlayers 3 (when map is already defined)? Also, why I'm unable to use mousemove event? I'm doing this: map.on('mousemove',function(e){ ...}); and it doesn't work.
Skodsgn
  • 940
  • 1
  • 10
  • 33
10
votes
4 answers

Unable to remove all layers from a map

I have a big map application, so to be representative I will have to provide just a chunk of code. So, this is how I try to remove all layers from a map: map.getLayers().forEach(function (layer) { …
Jacobian
  • 10,122
  • 29
  • 128
  • 221
10
votes
1 answer

Open Layers 3 feature fill with Canvas is not fixed to the feature

I've been working with openlayers 3 and created a fill with canvasPattern. The fill works, the problem is that it doesn't work as expected. I'd expect the fill to move with the geometry that it is filling, but as you will see in this…
Luigi Bosca
  • 101
  • 3
10
votes
1 answer

How to get a Map Control or Interaction

How does one get a specific ol.control or ol.interaction from ol.Map? I have several dynamically added maps on a single page and I want to be able to access the ol.interaction.Select.
MoreScratch
  • 2,933
  • 6
  • 34
  • 65
10
votes
1 answer

How do I decrease the size of Icon in openlayers 3, i am using bing maps

This is my code: var iconFeature = new ol.Feature({ geometry: new ol.geom.Point(ol.proj.transform([-95.3698,29.7604], 'EPSG:4326' , 'EPSG:3857')), name: 'Null Island', }); var iconStyle = new ol.style.Style({ image: new ol.style.Icon({ …
user1960217
  • 131
  • 2
  • 3
  • 15
10
votes
2 answers

Updating to OpenLayers 3

I'm looking to update my application from OpenLayers 2 to OpenLayers 3. Is anyone aware of a Migration Guide (or something similar) that would help with this?
sfletche
  • 47,248
  • 30
  • 103
  • 119
9
votes
2 answers

How do I make a two-color dashed line style in OpenLayers?

I want to add a dashed stroke with two alternating colors to a feature in OpenLayers. Basically, I want to create a two color outline around polygon so that it shows up no matter what color the background is. I want the end result to look like…
Jo Sprague
  • 16,523
  • 10
  • 42
  • 62
9
votes
1 answer

Get all features from the Openlayers 3 viewport

I am trying to find out all the features which are visible (viewport) on a layer in Openlayers 3. I am able to find out a single feature if I add a click event to the map which is as follows. But I am not able to find all the features which are…
User1836
  • 151
  • 3
  • 13
9
votes
2 answers

How do I set crossOrigin attribute when using canvas.toDataURL?

So I'm trying to create a print map function for an OpenLayers 3 application I'm building. I'm aware of their example but whenever I attempt to use it I run into the dreaded tainted canvas issue. I've read the whole internet and come across folks…
Alex Marple
  • 2,908
  • 4
  • 17
  • 24
9
votes
1 answer

Openlayers 3 Offset RegularShape

For clustered features I would like to make the following style in OL3: A square, and on top of it another smaller square at the right-top corner. The bigger square would hold the symbol, and the smaller square would hold the number of the clustered…
Benedek Simo
  • 504
  • 5
  • 15