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

Drag an openlayers 5 map with the keyboard

I have a working map generated by this code: // create the map with the proper center var map = new ol.Map({ controls: ol.control.defaults().extend( [new ol.control.ScaleLine()] ), view: new ol.View({ …
Paolo Benvenuto
  • 385
  • 4
  • 15
2
votes
0 answers

Scale to resolution using Openlayers 5

Openlayers ScaleLine component has a way to convert from resolution to scale, but what about the other way around? Our customers are choosing a scale for each layer, indicating the scale where the layer should be visible. That's why I have to…
Stsje
  • 31
  • 1
  • 3
2
votes
2 answers

OpenLayers v 5.3.0 - get back attribution behavior

In new version v 5.3.0 (ol map library) Changed behavior attribution. Before I had icon "i" and under it all attribution for displayed layers. Now I have some flattened info. Developers gave instructions to use the previous…
Bear
  • 151
  • 1
  • 1
  • 9
2
votes
1 answer

why openlayers map not working in vue-cli 3

I have added ol package to my vue-cli project through npm install ol but the map doesn't load. there is no error and I just find an empty div in the result source. here is my code => the html part :
the js part…
Mostafa Shakoori
  • 195
  • 3
  • 17
2
votes
1 answer

Get total number of tiles to load

I want to get the total number of tiles needed to be loaded currently. The reason is to have a smooth loading bar for the map. I know about the demo at openlayers, but for me, that bar jumps all over the place (goes back and forth) because many…
KayleMaster
  • 331
  • 2
  • 13
2
votes
1 answer

How to place a HTML element on a map in OpenLayers

I am working on Openlayers 5.13 with jQuery 3.21. I am trying to place a html div element on the viewport of a map in openlayers. This element is supposed to have two check-boxes to filter out some content on the map. For this purpose I am using an…
2
votes
0 answers

Openlayers 5 add feature images

I want to add an images like vector feature to map. Now I use this code: const format = new WKT() for (let i=0; i
Veers
  • 21
  • 3
2
votes
0 answers

V5.0.3 Click simulation

I cannot create a new Click Event since ol V5 (example to simulate a click on a feature) : var coordinates = feature.getGeometry().getCoordinates(); var pixel = map.getPixelFromCoordinate(coordinates); var evt = new ol.MapEvent(); evt.type =…
Deguich
  • 51
  • 6
1
vote
1 answer

Not able to toggle Fullscreen button in openLayers

I am implementing fullscreen feature. I need to toggle fullscreen button in below 2 scenarios When fullscreen mode is false, I need to dispaly "fullscreen(as per code)" button on map. Which is working properly. When fullscreen mode is true, I need…
Sneha
  • 81
  • 1
  • 5
1
vote
1 answer

How to change the appearance of an OpenLayers marker ("feature")?

I am struggling through some of the OpenLayers API and got it to display a number of Feature objects, but they are blue circles and I would like them to look somewhat more like the markers in Google Maps. How can I change their…
Jason S
  • 184,598
  • 164
  • 608
  • 970
1
vote
0 answers

What event can help us to catch complete map rendering in Openlayers?

I'm creating an OpenLayers draw application where I let users draw shapes and then I allow them to print maps on pdf by zooming into the drawn shape. My current code is working for - Draw Geometry, Zoom to the geometry. For printing, I'm currently…
krishna lodha
  • 381
  • 3
  • 9
1
vote
1 answer

Openlayers Pbf vector tiles bad performance

So, I have performance issue using pbf vector tiles while panning/zooming in and out until tiles are being rendered (eg. if you try to zoom in and pan before tiles are rendered screen will freeze shortly), after rendering is done everything runs…
1
vote
1 answer

OpenLayers Create raster grid from array of values

I am trying to create a raster grid from an array of data and display the layer in OpenLayers. I have found an example but it is for OpenLayers v2, and I cannot figure how to do it with latest version of OpenLayers (5 or 6). Example with OpenLayers…
s222
  • 13
  • 4
1
vote
1 answer

Check if coordinates are on the boundary of a feature in OL

I am using OpenLayers 5 https://openlayers.org/ and cannot find a solution how to check if given coordinates are on the boundary of a feature. I played with map.getFeaturesAtPixel and geometry.intersectsCoordinate, but there is always the problem…
K.E.
  • 818
  • 2
  • 12
  • 28
1
vote
0 answers

OpenLayers - polygon boundary

I have my map object created like this: new ol.Map({ ... view: new ol.View({ center: ol.proj.transform([15,49], 'EPSG:4326', 'EPSG:3857'), zoom: 10, minZoom: 7, maxZoom: 18, extent:…
user3523426
  • 836
  • 3
  • 11
  • 26