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

Is there any projection that doesn’t clamp values when calling toLonLat()?

In OpenLayers 5, when getting the view extent using const extent = this.view.calculateExtent(this.map.getSize()) and then converting it to latLng using toLonLat() the result values are clamped (-180 to 180 for longitudes) if the map is at a very low…
Ricardo
  • 180
  • 2
  • 12
0
votes
1 answer

OpenLayers 5 RegularShape feature is offset from specified coordinates

I'm placing custom markers on a vector layer, but the more downward a coordinates point is from the upper edge of a map, the more the marker shape is offset upwards from that point. I'm using different map projection (EPSG:5514), so there is…
Maja
  • 3
  • 1
0
votes
1 answer

Openlayers 5.3 How to reload ImageWMS source to show updated data from server

I created an openlayers map (version5.3). I added an ImageLayer, created an ImageWMS source to speak to an ArcGis server. The layer displays fine. I now need to refresh that layer every 30s. I tried to use the refresh method…
Uwe
  • 385
  • 6
  • 18
0
votes
1 answer

OpenLayers 5.3, get PROPERTIES from KML layer placemark

I've got a map with earthquake infos on different KML layers. There's a tooltip that shows up the infos of a specific place if you "hover" with the mouse on it. Eg. I move my mouse over "PUNTA CANA", there should be a tooltip with: NAME: Punta…
s__ale
  • 543
  • 5
  • 9
0
votes
2 answers

openlayers 5: move map center by a pixels value

I have an openlayers 5 map generated by: // create the map with the proper center var map = new ol.Map( { view: new ol.View( { center: ol.proj.fromLonLat([center.long, center.lat]), zoom: zoom …
Paolo Benvenuto
  • 385
  • 4
  • 15
0
votes
1 answer

Load open layers map to electron js with typescript imports

I'm trying to load openlayers map in electron using typescript imports. But when compiling following exception pops up This is the code I am trying to run import Map from 'ol/Map'; import View from 'ol/View'; import TileLayer from…
0
votes
1 answer

openlayers5: click event position not properly set on map

I'm trying to open a popup in a map with markers, getting the markers points from a list where latitude and longitude are given, and they are plotted correctly in the map. Following https://openlayers.org/en/latest/examples/popup.html I added the…
Paolo Benvenuto
  • 385
  • 4
  • 15
0
votes
1 answer

Reproject static image: updating source transforms the image again

Got stuck.......I'm loading png images onto OpenStreetMap as a static image layer. When I reproject the map from e.g. 3857 to 32661 the image is also reprojected automatically (which I wanted), but when I update the source of the static image the…
user1939338
  • 117
  • 9
0
votes
0 answers

Openlayers-5 WFS-T: formatGML with srsName:'EPSG:4326'

I'm implementing a editing feature with WFS-T and I realise that when I use srsName: 'EPSG:3857' in my formatGML every thing run good, but whe I use a different one e.g. srsName:'EPSG:EPSG:4326' I get a projction erro from the Geoserver. My layer…
0
votes
1 answer

Error when trying to import OL5 with NodeJS and Express

I want to import OpenLayers 5 in my NodeJS Express application, but I get an ERROR when I try to do this. I have this version: "ol": "^5.3.0" EDIT: I installed Babel. Now I still get the same error when I try to import in the client.js =>…
Trisha
  • 75
  • 8
0
votes
1 answer

OpenLayers v5.3 custom style for each vertex

From what I see in the documentation and examples, I can edit all the vertices with the same by Fill style. I want to identify the order of the polygon creation. Is there any way to give each vertex a different color / unique number?
Ezri Y
  • 407
  • 3
  • 15
0
votes
1 answer

OpenLayers 4.6.5 Setting a feature colour

So I'm trying to set a feature colour like so, addInteraction() { this.style = new Style({ fill: new Fill({ color: this.fillColour, }), stroke: new Stroke({ color: this.lineColour, width: 2 }), …
Munerz
  • 1,052
  • 1
  • 13
  • 26
0
votes
1 answer

confusing usage of bind in openlayers library source code

I am looking into the source code of the openlayers javascript library. And in the file of source/CartoDB.js, I find there is something as following: class CartoDB extends XYZ { constructor () {} initializeMap_() { ... const client =…
Chris Bao
  • 2,418
  • 8
  • 35
  • 62
0
votes
0 answers

How to use MousePosition at Openlayer 5 with vanilla js?

What's wrong with my code? I want to get coordinates with mousePosition. I use openlayer v5. var map = new ol.Map({ target: 'map2', layers: [ new ol.layer.Tile({ source: new ol.source.OSM() }) ], view: new…
Ardhi Cho
  • 41
  • 1
  • 5
0
votes
1 answer

OL: changing projection (using Proj4) does not show geojson layer (despite setVisible is true)

Using a layerswitcher the visibility of several GEOJSON-layers can be toggled. E.g. layer A is visible (so setVisible is true) on a map with projection 3857. When I change the projection to e.g. 4326 (or another one by using Proj4), I get the new…
user1939338
  • 117
  • 9