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
1
vote
1 answer

How to show Bing map layers with OpenLayers

I want to show the Bing map layers on the HTML page using OpenLayers. I've got the Bing API too, but the map is not shown. This is the code I have downloaded and changed. Is my API wrong? I got the API recently from the site. …
Ali Hosein pour
  • 220
  • 4
  • 19
1
vote
1 answer

Xamarin: Error trying to show WebView using OpenLayers maps with html and javascript

I'm trying to show a map in xamarin using a WebView component, try passing this code to an html file and it works fine. The WebView is from Xamarin.Forms The line alert('test'); and the word App in the body of the html is shown without problems,…
luciano cba
  • 185
  • 2
  • 13
1
vote
2 answers

Displaying custom local image marker in OSM using OpenLayers

I have followed the tutorial on how to display a custom image as a marker from this article: https://medium.com/attentive-ai/working-with-openlayers-4-part-3-setting-customised-markers-and-images-on-map-da3369a81941 However, when using my own local…
abarc
  • 89
  • 1
  • 11
1
vote
2 answers

Error in OpenLayers when I try to change the map view

I'm trying to get started doing geocoding with OpenLayers and Nominatim, but when I try to change the view of the map (say, because the user entered an address and I want to center of the map on it) I get an error: ol-debug.js:6171 Uncaught…
ekolis
  • 6,270
  • 12
  • 50
  • 101
1
vote
2 answers

How to debug a bundled (parceljs) JavaScript file (using OpenLayers) properly?

I have: Django app with JavaScript using the OpenLayers library using Parcel for bundling (pipenv and yarn for package management) (PyCharm for development) Everything works basically, but I ran into a problem with OpenLayers and debugging seems…
mogoh
  • 992
  • 2
  • 7
  • 27
1
vote
1 answer

How do I subscribe to OpenLayers 5.3.0 events in JavaScript?

I see that OpenLayers 5.3.0 is making use of observables. The docs also cover events. How would I alter this starting example to .subscribe() to events in general? I'm struggling bridging the gap between docs and use. import Map from…
Christopher Stevens
  • 1,214
  • 17
  • 32
1
vote
1 answer

Change scale and measurement according to a projection in openlayer5

I am building a image tiles based map using openlayer where I changed the projection to a custom one instead of default EPSG. I need the scale to show the correct scale according to my distance to pixel ratio and also need the measurements according…
dementor
  • 85
  • 6
1
vote
0 answers

Get mouse position when the user click on map in webpage with javascript and openlayers

On site openlayers.org, there is a code showing the position of the mouse on the map. But it does not store the position in a variable to use by the user. I want to have a code showing the position of the user in a window when the user clicks on the…
Ali Hosein pour
  • 220
  • 4
  • 19
1
vote
1 answer

TileMill MBUtil: Tiles not loading in Openlayers

I've exported the MBTile file using MBUtil but it wasn't generating all the PNG tiles when I'm creating the Overlay map using OpenLayers. What am I missing?
JCC
  • 13
  • 3
1
vote
0 answers

Google Maps to OpenLayers - Marker Click Listener Equivalent

I am working with OpenLayers 5 trying to create the equivalent of a Google Maps Marker equivalent. I've been following the example here: https://openlayers.org/en/latest/examples/icon.html Unfortunately, it appears I can only add a listener to the…
1
vote
2 answers

map.on('singleclick',function(evt){}); is registering many times when single click is called

I'm calling this function for first time and single click, it works fine but if I call same function map on single click again then it is registering multiple time(I checked using alert); var flagforClick = false; function getData() { if…
1
vote
1 answer

How to get the extent of a GPX file to display it on a map (using openalyers)

I am working on the GPX source example of openlayers 5.x available at https://openlayers.org/en/latest/examples/gpx.html I am able to successfully load my GPX file and to display it on a map, but I have been unable to get its extent to know the…
A. Pace
  • 45
  • 1
  • 8
1
vote
1 answer

Cannot add BingMaps layer dynamically

I'm trying to add a BingMaps layer to an already initialized map. I'm getting an errorwhich I cannot make any sense of. Do you have an idea what's wrong? I'm using OpenLayers 5.3.1. TypeError: r is null[Weitere Informationen] map.js:1:677385 • …
benjist
  • 2,740
  • 3
  • 31
  • 58
1
vote
1 answer

Openlayers 5 Select Vector

I'm trying to follow this example I've added this to a button's (click) handler let selectClick = new Select({ condition: click }); mapValues.map.addInteraction(selectClick); selectClick.on('select', function(e) { console.log("Features selected : "…
Funn_Bobby
  • 647
  • 1
  • 20
  • 57
1
vote
1 answer

What to do with Mbutil Export for TileMill and Mapbox

Hey all. Im just trying to figure out how to use my mbtile directory export. My files are located in a local directory "/mytiles". How can I configure this to use my custom layer?
Rivers
  • 2,102
  • 1
  • 16
  • 27