Questions tagged [openlayers-5]

v5 specific questions on the OpenLayers mapping library

OpenLayers v5 is the latest release of the OpenLayers mapping library.

From https://openlayers.org/:

OpenLayers makes it easy to put a dynamic map in any web page. It can display map tiles, vector data and markers loaded from any source. OpenLayers has been developed to further the use of geographic information of all kinds. It is completely free, Open Source JavaScript, released under the 2-clause BSD License (also known as the FreeBSD).

v5 reworked the library as a set of ES Modules, and improved compatibility with mainstream module bundlers.

317 questions
1
vote
1 answer

Opacity is not applied for Fill for KML layer in openlayers 5

I am currently upgrading our openlayers from 2.x to 5.3. We have some KML files on the server which should be displayed as individual layers on the map. This is working perfectly fine after the upgrade except that the fill of the polygons of the…
Felix H
  • 155
  • 1
  • 2
  • 10
1
vote
0 answers

Openlayers: add Geocoder control to custom DIV

Geocoder is located in the MAP div. I would like to add this control into a custom div (with id "mapbar") outside the MAP div. How can I achieve that...... var geocoder = new Geocoder('nominatim', { provider: 'photon', lang: 'en-US', …
user1939338
  • 117
  • 9
1
vote
2 answers

OpenLayers 5 get extent coordinates

I am trying to create a MultiPolygon from an extent in OpenLayers 5 I'm getting the extent through map interaction of dragBox let extent = selectBox.getGeometry().getExtent(); myService.select(extent); select(extent){ let topLeft =…
Funn_Bobby
  • 647
  • 1
  • 20
  • 57
1
vote
1 answer

Clustering markers at openlayers 5

I'm building a tracking system, it receives location signal from a websocket and display the location long with the icon on the map. I need now to make clustering, I read this but did not get how to amend my code to work with it. The 'openlayers'…
Hasan A Yousef
  • 22,789
  • 24
  • 132
  • 203
1
vote
1 answer

OpenLayers can't initalize map using Component class and webpack

I'm trying to rebuild this tutorial. Instead of using Leaflet (which is working, but for different reasons, I don't want to use Leaflet), I want to rebuild it using Openlayers, but I can't initialize the map using OL. I get this error message in…
didi_o
  • 23
  • 3
1
vote
1 answer

Can you extend open layers layer class?

I am trying to extend OpenLayers class with es6 syntax in typescript. I have run a few tests in jest to verify that my new class is a VectorLayer instance. I have been able to use methods like setSource and they appear to work in tests. However,…
1
vote
2 answers

Check coordinates/places inside polygons in openlayers

I have some code by which I am checking places or coordinates inside in polygons or not. The problem is it may have 10000 places or more which is getting performance issue and map is getting slow. Please find my code below: places.forEach(p =>…
user10496245
  • 217
  • 3
  • 17
1
vote
1 answer

How to find equivalent coordinates in current world from other world in openlayers without mouse event

I have an OpenLayers map with a Polygon in every world. I have added an animation on view which pan's to the polygon on button click. The problem is if the user is in other world than the one in which polygon's geometry lies, the animation takes…
capnam
  • 429
  • 9
  • 25
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

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

How to implement sidebars to openlayer 5

In Git-Repro https://github.com/Turbo87/sidebar-v2 sidebar-v2 is presented but I can not bring it to work with ol5 when I like to import in a external .js file the necessary sidebar-v2 methods. Tried to include the repros content into my repro but…
JohPel
  • 61
  • 1
  • 5
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

Unable to Load Vanilla GeoJSON in Openlayers 5

I'm starting with some valid GeoJSON which I've built using https://geojson.io. My desire is to load it in an Openlayers 5 map. I started with this tutorial, and attempted to use a remote source in place of a local one. The relevant block looks…
brianbancroft
  • 463
  • 3
  • 17