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

OpenLayers 5 add conditional style to Text

I am trying to add conditionally styled text to vector object that I am placing on the map. I have a service that creates the "Style" that looks like this let myStyle = new Style( { fill: new Fill({color: Shade}), stroke: new…
Funn_Bobby
  • 647
  • 1
  • 20
  • 57
0
votes
1 answer

How to remove a feature in openlayers with multiple possible sources

I have a map with multiple layers, all connected to different vector sources. When a user selects a feature I want him to be able to delete the feature. However, I can't seem to find a way to locate the source layer the feature is from. If I try to…
Astrogat
  • 1,617
  • 12
  • 24
0
votes
1 answer

Using projection EPSG:4322 in openlayers view is not working even after defining in proj4js

I'm trying to use WGS 72 "EPSG:4322" in my openlayers project. However, using this projection does not work. When trying this projection all layers disappear. I have found an example in the latest openlayers examples showing reprojection from…
0
votes
0 answers

Openlayer 5 - Query style color gives wrong result

i have a OSM with a vector layer (three circles with locations loaded from a GEOJSON file). Clicking on a feature (circle) causes a color change of the circle. That work's fine: map.on('click', function (e) { var pixel =…
mcatis
  • 1,176
  • 4
  • 11
  • 24
0
votes
1 answer

Use OpenLayers 5 typescript extent.js in Angular 7

I am trying to use the "extend" function extent.js which is included under "ol" as an independent file in my code. I tried importing it like this... import olExtent from '../../../../../node_modules/ol/extent.js'; but I get an error saying default…
Funn_Bobby
  • 647
  • 1
  • 20
  • 57
0
votes
1 answer

Openlayers 5 serve local MBTiles

I'm trying to serve tiles from a local .mbtiles in an Ionic 4 project. Step by step I managed to download the mbtiles and to create successfully the source using XYZ new XYZ({ tileLoadFunction: (tile: ImageTile, url) => { //stuff }, …
dvdpzzt
  • 73
  • 1
  • 9
0
votes
0 answers

OpenLayers: can't i get features of VectorSource outside of event listener?

i'm trying to show only a certain feature from my Vector Source. so i make a function like this: function showUtility(id) { utilitiesSource.forEach(function(i) { //console.log(i.getFeatures()); …
Bang Fady
  • 151
  • 2
  • 13
0
votes
2 answers

OpenLayers 4 extent.extend replacement

I am moving code from OpenLayers 3 to OpenLayers 4 (typescript) I had this piece of code that would extend my extent so that all vector shapes I drew would be visible when the map loaded... angular.forEach(webMapValues.vectorFieldLayer, function…
0
votes
1 answer

get trkpt details with openlayers

I'm showing a map with a GPX-track using openlayers 5.3. Trackpoints in OL default to a MultiLineString geometry type. The GPX-example has a gpx-file that is double the size because all tags are duplicated as tags. Routepoints get a…
Ome Ko
  • 3
  • 2
0
votes
1 answer

Openlayers 5 icons are not showing on the map

I'm using OpenLayers 5 to create a simple map with icons on it. I have followed the Icon Colors example and it works. Now, I changed the source data from an array. I have, for example, four points to show on the map. window.locs = [{ "y":…
user2018
  • 310
  • 2
  • 7
  • 21
0
votes
1 answer

How do I update marker position via geometry, with a smooth transition?

I'm currently on a ReactJS+Nodejs application, trying to integrate OpenLayers. What I need is to change the GPS position of a marker, in real-time (via socket.io). So far, I've come up with this code: this.map = new Map({ target: "map", …
edwardffs
  • 412
  • 1
  • 5
  • 17
0
votes
1 answer

OL: static image (using proj4 defs) overlay with LONLAT bounds - result wrongly positioned (is shifted)

I have an image from weathermodel output. It's a transparent (static) image that I need to overlay on an (openlayer) map. The image itself is based on a polair stereographic projection (EPSG: 32661). I use proj4.defs for 32661. The imgExtent I got…
user1939338
  • 117
  • 9
0
votes
2 answers

Openlayers5 hide features

I have some code to init map with points. Coord of points I get from json and in the end of file I have a filter. I need to hide/show some points on map. How I can do it? setStyle() or change size of image don't work. Any idea? // coordinates var…
0
votes
1 answer

Get KML style in OpenLayers 5

I have some code in an application that access the style of a selected feature in a KML layer. It was working in OpenLayers 3.1. I have now upgraded to 5.3.0 and it stopped working. See the relevant lines below: var featStyle =…
user2395126
  • 526
  • 1
  • 7
  • 20
0
votes
1 answer

How to adjust overlay on polygon to left and right in openlayers

I have openlayers map with a polygon feature. When we hover over the polygon, it displays the description in overlay. However the overlay is always displayed on the polygon and not to left and right which is what I am trying to do. In doing so I…
capnam
  • 429
  • 9
  • 25