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
9
votes
1 answer

Open Layers 3 search functionality to find a map location?

What is the best way to implement a search functionality into an OL3 map? I need a search input that will show me a few options while searching and then pan and zoom to the specific search term. Pretty much like google maps do. Do I need to…
Nicolas T
  • 327
  • 1
  • 5
  • 15
9
votes
3 answers

Ensuring all tiles are loaded in Open Layers 3 XYZ source

We have some layers that make use of a ol.source.XYZ source. For the loading strategy we use ol.loadingstrategy.tile(new ol.tilegrid.createXYZ({})). We need to ensure that all tiles have been completely loaded in the map view before proceeding with…
Scott
  • 729
  • 1
  • 11
  • 30
9
votes
1 answer

How to add a http header to openlayers3 requests?

How can I inject a http header into every map layer request? In this case, I need to send an Authentication header for a given layer and source, but I may want to send other headers too. A search of the code and docs came up with no clues.
MDD
  • 201
  • 2
  • 8
9
votes
3 answers

How to get the extent of a GeoJSON vector source?

I have this GeoJSON file (polygon.geojson)... { "type": "Feature", "geometry": { "type": "Polygon", "coordinates": [ [ [73, 15], [83.0, 15], [83, 5], [73, 5], [73, 15] ] ] }, "properties": { "name": "Foo" } } ...and use it as vector…
Mark
  • 479
  • 4
  • 12
9
votes
1 answer

How to specify the projection for GeoJSON in openlayers3?

My intention is to load GeoJSON data and display it on the map. Coordinates of the features specified in GeoJSON are normal lon/lat. For some reason openlayers is rendering them using the projection used by the map and without converting them. //…
boreq
  • 791
  • 2
  • 10
  • 18
9
votes
2 answers

OpenLayers 3: Remove event listener

In Openlayers 3 how to remove a event listener attached like this: var a = map.on("pointerdrag",function (e) { // event handler }); var b = map.on("pointerdrag",function (e) { // event handler }); How do I remove only…
Shaunak
  • 17,377
  • 5
  • 53
  • 84
9
votes
3 answers

Openlayers 3 - What does resolution represent as a style function parameter?

I am trying to use resolution passed into the StyleFunction to work out the size of my image Icons. Using tests, at a zoom where the scale line is 100m the resolution reported to the styling function is 2.3886. I've take screenshots of the scale…
user4773894
9
votes
2 answers

OpenLayers 3 get extent of all feature contents in a list

I want to zoom on the extent of all the features contained in a list. Firstly, I put my feature in a list: selectedFeatures = []; vector2.getSource().forEachFeature(function(feature) { var att = feature.get("NOM"); …
FatAl
  • 859
  • 1
  • 6
  • 20
9
votes
6 answers

How can I use an SVG image as a map marker in OpenLayers-3?

I am trying to create map "pin-drops" (ie. map markers) in OpenLayers-3 (OL3) using SVG images. Currently, I am using PNG images as the pindrops that reference the ol.style.Icon source (“src”) property attribute just fine. However, this fails using…
FreeBeer
  • 91
  • 1
  • 1
  • 4
9
votes
1 answer

OpenLayer3 - how to get coordinates of viewport

I have a MapQuest displayed with OpenLayer3. I want to get coordinates of viewport (map area curretnly displayed). For the whole map this should be like this:(180,90) x (-180,-90). but I got: Top-right longitude: 37570328.14272983 Top-right…
P.K.
  • 1,746
  • 6
  • 25
  • 62
9
votes
5 answers

Use Semantic-UI (or Font Awesome) icons as markers in OpenLayers3

Is there a way to use icons from Semantic UI or FontAwseome as markers icons in OpenLayers3 ? OpenLayers features the feature style Text that can be used as follows: var blackFill = new ol.style.Fill({color: 'black'}) var whiteStroke = new…
Antoine Trouve
  • 1,198
  • 10
  • 21
9
votes
3 answers

OpenLayers that is not minified?

I'm trying to find an OpenLayers3.js file that is not minifed, it is a pain debugging stuff that is minified, can anyone help me find it? Im using this address now: http://openlayers.org/en/v3.0.0/build/ol.js By the way, it is a special thingy at…
petur
  • 1,366
  • 3
  • 21
  • 42
8
votes
2 answers

Search address with openlayers

I have a project in PHP and I'm using openlayers for maps, but I need to locate bookmarks by passing a list of addresses, it has to be a free geocoder since there are many addresses. Thank you very much.
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 catch event after drawend added to source in OL3?

I'd like to update a list after each feature has been drawn to a map. When I use drawend to catch the finishing of a drawing, the feature being drawn is not yet added to the vector source at that moment. So var draw = new ol.interaction.Draw({ …
hyperknot
  • 13,454
  • 24
  • 98
  • 153