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

Openlayers cluster with some markers in same location

I need an example for this scenario that I have a cluster with 5 or 10 markers and all of them have same latitude and longitude and if I click on the cluster all those markers will be showing as a circle with spaces. Is it possible? If so could you…
Hey
  • 53
  • 4
2
votes
1 answer

How to improve performance of getFeaturesAtPixel?

I use the "map.getFeaturesAtPixel" method to exactly get the first feature under on a mouse-click interaction. This works as expected even though the method does not return a single feature but all the features whose graphical representation hits…
Alberto
  • 75
  • 4
2
votes
1 answer

Snapping to features on multiple layers

I am having problems using the OpenLayers snapping functionality. I need to have several layers on my map and use the snap on all. I have tried an option creating a collection but it has not worked. Another option does work but I don't know if it is…
2
votes
1 answer

how to change OpenLayers 5.3's tile language

I am working on a map application using OpenLayers 5.3.0. How can I change the language for the map tiles? when I view Japan or Korea, all the places are displayed in the local language. How can I change it to English? I searched on the official…
IdontEvenEven
  • 145
  • 2
  • 13
2
votes
0 answers

How to make OpenLayers (5.3.3) work in a VisualStudio/Asp.Net.Core/TypeScript environment

As stated in the headline I would like to use the current version of OpenLayers via TypeScript in a Asp.Net.Core project. I downloaded OpenLayers via npm install ol. This package does NOT contain a ol.js file NOR any type definition files (*.d.ts)…
2
votes
0 answers

Using OpenLayers 5.3 in TypeScript without Node.js

I would like to use the latest version of OpenLayers (5.3) in small project. The requirements are: no Node.js - I will be running thing on the site hosted on IIS, simple HTML files scripts need to be written in TypeScript ES5 I've read a lot of…
2
votes
0 answers

Is there a way to apply a CSS class to an Openlayers 5.3 feature?

We have over 2000 map points to draw in an openlayers (5.3.2) map. Performance is a big issue as we are: creating a vector layer, adding a feature per point (for location of tooltip), adding an overlay per point (for material icon with css class…
Corné
  • 125
  • 1
  • 2
  • 14
2
votes
1 answer

I can't transform geometries to a projection defined in proj4.defs in openlayers 5.3

I have a Node mapping application that uses openlayers V5.3.0. When I try to transform geometries from EPSG:4326 to a projection defined using proj4.defs I get this error message: TypeError: Cannot read property 'getCode' of null If I change…
Graham H
  • 125
  • 12
2
votes
0 answers

Add multiple features to vector layer on click OpenLayers 5 Typescript

I'm trying to add features to a layer on click and I have been successful but it seems that when a feature is added the other feature is hidden? I create the parts of the layer I need... public static highlightOverlay = new olLayerVector({}); …
Funn_Bobby
  • 647
  • 1
  • 20
  • 57
2
votes
1 answer

Stop to add points in a polygon with openlayers 5.3.0

In my web page, users can draw a polygon and then modify it. However, I would like to only allow users to drag and drop the drawn corners, not add new points into polygon when a polygon is modified. In the example below, I created a polygon with…
Bangyou
  • 9,462
  • 16
  • 62
  • 94
2
votes
1 answer

Add an icon on the map with OpenLayers 5

I'm trying to add an icon on the map with OpenLayers 5. I've tried to follow the Openlayers sample on the site, but without success (https://openlayers.org/en/latest/examples/icon.html) I believe that the problem may be the Style, because when I…
rmmariano
  • 896
  • 1
  • 18
  • 32
2
votes
1 answer

Can we use html tags and css to style the features in openlayers?

I have a polygon feature in OpenLayers 5. It has some random id which I need to show at the center of the polygon slightly right aligned. I have used the ol.style.Text() style to display the id on polygon. I can manage the alignment using the…
capnam
  • 429
  • 9
  • 25
2
votes
1 answer

Lock zoom of WMTS tiles in OL

I'm using tiles from IGN Géoportail WMTS to render a background map as outlined in this example: var resolutions = []; var matrixIds = []; var proj3857 = getProjection('EPSG:3857'); var maxResolution = getWidth(proj3857.getExtent()) / 256; for (var…
svoop
  • 3,318
  • 1
  • 23
  • 41
2
votes
1 answer

OpenLayers Draw modules in React components doesn't update the map

I'm working on an OpenLayers map that uses React as a wrapper for all the other UI stuff. As such, I'm also trying to component-ize some of the features, in this case the drawing. Below is an attempt to recreate the example found in the OpenLayers…
jktravis
  • 1,427
  • 4
  • 20
  • 36
2
votes
1 answer

Using OpenLayers, how can I display different icons for different features on a single layer?

firstly I'm new to Openlayers/JS as a whole and fairly inexperienced with programming in general so there might be other problems with my code that I'm not aware of. I am using the latest version of Openlayers (5.3.0). My program currently passes…
1 2
3
21 22