Questions tagged [openlayers-6]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
9 views

Serving Tiles of format {z}/{x}/{-y}.png in Openlayers version 6.3.1

I am facing a problem in serving the map tiles in Openlayers the format for the tiles is {z}/{x}/{-y}.png but when i try to add this url into the tile source it is giving me the following error ...
0
votes
0answers
36 views

Getting vertices of geometry that type is not known?

I am using a WFS service that serves Polygon and Multipolygon geometries. But I do not know ehich ones. So I am converting the wfs response to feature. this.http.get(url, { responseType: "text&...
0
votes
0answers
29 views

Vector tile selection layer (canvas) drawn outside the map div. Bug?

I loaded a PBF vector tile layers into my map, and when I select a feature, OpenLayers 6.3.1 creates the selected layer canvas outside the map. Is it a general problem, or just mine? I don't attach ...
0
votes
1answer
43 views

Can't fix this error using OpenLayers v6.3.1 release

I'm very new at using OpenLayers. I really would like to test the consumption of a WFS xml file being returned from a REST call. Using Openlayers v6.3.1 release: https://openlayers.org/download/ I ...
1
vote
1answer
39 views

Import ol-ext to a React - Open Layers 6 project

I'm trying to set up a React project where I want to use some of the tools provided by the ol-ext. I looked around and found some Codesandbox projects from the creator of the library but I was unable ...
1
vote
0answers
28 views

OpenLayers 6 add rulers

I'm trying to add vertical and horizontal rulers on top of my map. In OpenLayers 2 I have seen code that had VerticalRuler and HorizontalRuler as attributes but I can't find something similar in ...
1
vote
1answer
50 views

Detecting self-intersecting polygons in OpenLayers [closed]

I am using OpenLayers Version: 6.3.1. I am allowing users to draw a Polygon in my website. I want to validate the polygon by checking for self intersection. Like This: I referred to Detecting polygon ...
1
vote
1answer
39 views

Adding Street layer to a Satellite map

I am new to openlayers and I am using OpenLayers Version: 6.3.1. I need to display a satellite map. I have used mapbox API to display the satellite map. It doesn't have streets and displays only the ...
0
votes
2answers
43 views

Why ol-layerswitcher latest version can't run in OpenLayers?

I did try load "ol-layerswitcher" in OpenLayers but It didn't work. Furthermore I tried run that through its examples in GitHub but it didn't show anything. Where is my mistake? <!DOCTYPE html> ...
2
votes
1answer
49 views

Static image layer combined with vector layer in OpenLayers 6

I'm trying to have an image layer combined with a vector layer but when I add projection to View the vectors disappear. Am I doing something wrong? Here is an example of what I'm trying to achieve: ...
0
votes
1answer
79 views

GetLegendGraphic and getLegendUrl function filter by extent

I tried to get a legend image from my GeoServer Instance filtered by extent (render only symbologies that are currently displayed on screen). For this purpose I used the getLegendUrl function from ...
0
votes
0answers
32 views

OpenLayers 6 : Display radius while drawing

I tried to draw a Circle in OpenLayers 6+. It works perfectly but I would like to display the radius line as it was displayed in OpenLayers 3 (see the bellow example): http://tsauerwein.github.io/...
0
votes
0answers
20 views

OpenLayers interaction modify point move

My modify code modify = new ol.interaction.Modify( { source: drawvectorSource, pixelTolerance: 50, } ...
1
vote
0answers
32 views

Experience with issues faced while upgrading from OpenLayers 4 to 6

We are thinking of migrating from OL 4 to 6, skipping 5. I read the upgrade notes, but I wanted to know if someone here also jumped from v4 to v6 and their experience if they faced any major hurdles ...
1
vote
1answer
31 views

How can GeoJson polygons be colored programmatically using OpenLayers 6?

In my GeoJSON file, there is an attribute for each polygon. I am trying to update the fillcolor of the polygon base on the value of an attribute in the GeoJSON file. I have a function getColor() that ...
0
votes
0answers
33 views

How to trigger map event in OpenLayers?

In OpenLayers v5.3.0 I would like to call a function once map have finished rendering all layers. I only know how to register a function for said event lisener, but don't know how to trigger it. I do ...
0
votes
1answer
23 views

Zoom to polygon's extent in OpenLayers

I've an array of coordinates that represent a polygon, inspired from this official example I've modified "Fly to Bern" for my aims. <button id="testID">Test</button> <script type="text/...
0
votes
0answers
46 views

Displaying a PNG file over a OpenLayers v6 map

I am having difficulty finding a clear solution to this, I may just be over complicating it but I am not sure how to just add a static PNG file over top of a OpenLayers map with a opacity of 0.5. I've ...
1
vote
0answers
23 views

How to change Openlayers MousePosition control as mouse up?

I am using openlayers 6.x and Mouse position control. this.control = new MousePosition({ coordinateFormat: createStringXY(this.precision), className: this.className || "mouse-position", target: ...
0
votes
0answers
38 views

Migration from OS OpenSpace API to OpenLayers 6.3 - Cannot get icons to show

So I've setup a fixed point to render, co-ordinates are translated from LonLat to GB OS coordinates. Code generates no errors but also doesn't render the icon. Icon path has been checked and is ...
1
vote
1answer
38 views

Differentiate style used to render vertices of lines and polygons from style used to render plain point features?

Context I'm using OpenLayers 6 to let a user make some (multiple geometries) drawings (i.e. vector features) on map. I build a function to render the different geometries. I also wanted to display the ...
0
votes
0answers
50 views

Add GeoServer WMS layer on web page using OpenLayers

I am trying to add GeoServer WMS Layer using OpenLayers on the web page. And here is my code: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WMSLayer.aspx.cs" Inherits="OpenLayerMap....
1
vote
1answer
38 views

How to get the co-ordinates of the clicked point using 'ol/Draw' in OpenLayers 6?

I am trying to create a measure tool using OpenLayers 6. I did get examples to measure distance and area using the ol/Interaction/Draw and ol/geom library classes. I want also to measure the ...
0
votes
1answer
22 views

Openlayers with multiple TileLayers with WMTS source, second layer shifted

I'm trying to create map widget with multiple layers. Base layer is OSM base map. Upon that I add two more layers with different CRS. Layer A is added with EPSG:3912. Layer B is added with EPSG:3857 (...
1
vote
1answer
19 views

How to unset an event listener in OpenLayers 6?

I am trying to use '.un' to unset the 'single-click' event listener. I have tried all the ways available. How can I do this? measurePoint() { const that = this; this.mapObj.on('singleclick', (e) =...
1
vote
0answers
20 views

Blured tiles while loading map

It might be a stupid question but I need to ask it. On the latest version of OpenLayers which is using OSM tiles, when you are quickly zooming map the tiles which are not loaded yet gets blurry: On ...
0
votes
0answers
41 views

Openlayers 6 geometry editing not smooth in mobile

I am working on an ionic application and implementing geometry drawing using OpenLayers 6 the problem is that when I try modify the the geometry, it is working well in browser but it hangs in mobile. ...
1
vote
1answer
73 views

Loading GeoJSON in OpenLayers?

I am trying to load GeoJSON in OpenLayers, however, the polygon isn't visible on the map. What am I doing wrong? <!doctype html> <html lang="en"> <head> <link rel="...
0
votes
1answer
64 views

GeoJSON layer fails to load

I'm downloaded OpenLayers v6.3.1 libraries and successfully displayed a simple map on my local server, and nom I'm trying to load a GeoJSON file as a new vector layer into this map. But for some ...
0
votes
2answers
47 views

CORS problem when trying to call WMS getFeatureInfoUrl using OpenLayers [duplicate]

I'm using the newest stable version of OpenLayers which is 6.3.1. I have a problem when trying to call http request on an url genereted by the wmsSource.getFeatureInfoUrl function. It returns me an ...
0
votes
0answers
23 views

OpenLayers - DragBox Interactions for Touch Screens

I am in the process of upgrading a system from OpenLayers 5.x to 6.x. The only issue I've run into so far has to do with a hack I implemented some time ago to enable the DragBox interaction on ...
0
votes
1answer
37 views

How to translate a pixelCoordinate between different map sizes? OpenLayers 6.3.1

My starting point for this question is the ability to print a map with a given format&resolution, very similar to the "Export to PDF" example at OpenLayers webpages: https://openlayers.org/en/...
1
vote
1answer
69 views

Getting error when I add drawing feature to the map

I use OpenLayers 6. I try to add to the map interaction a class to draw features on the map. Here is MapDraw class: function MapDraw() { this.vector = new ol.layer.Vector({ ...
1
vote
0answers
98 views

Jumpy mouse wheel zoom in OpenLayers

I'm using ol.View option constrainResolution: true so that mouse scroll zooming has the same zooming steps as clicking in + or - zoom control. There are no custom view resolutions set, just plain XYZ ...
-1
votes
1answer
30 views

Openlayers blank map after construction for production

I follow this OL tutorial to build an Openlayers app. I am very new with that sort of dev environment (nodejs/parcel).All is working fine when in dev. OSM Tiles and MapServer Layers appear in web ...
0
votes
0answers
42 views

OpenLayers 6 ol.source.ImageWMS does not use/follow provided resolutions

Even though layer source resolutions are as follows var source = new ol.source.ImageWMS({ url: this.url, params: parameters, ratio: 1, resolutions: [396.8757937515876, 132....
0
votes
0answers
41 views

How to render map using OpenLayers (5 or 6) from cached tiles?

I am using OpenLayers 2 for rendering map (from PostGIS database) and tilecache for caching map tiles using XML. Now I want to upgrade to a higher version of OpenLayers, for that I want to know a good ...
1
vote
1answer
117 views

Display all mapfile layers with Openlayers

I'm using the following code to display my mapfile layers: var wmsSource = new ol.source.ImageWMS({ url: 'http://localhost/cgi-bin/mapserv.exe?MAP=/ms4w/apps/GEO/test.map', ...
0
votes
1answer
306 views

Problem with mouse zoom in Open Layers 6

I'm using latest version of OpenLayers 6 and I noticed that even in the official examples there is small problem (or it is a feature) with mouse zoom. When I set zoom restrictions then while using the ...
0
votes
1answer
62 views

Map panning using mouse wheel in OpenLayers 3+ [closed]

How to achieve functionality that user could scroll through map by pressing mouse wheel and dragging map like he can do it by pressing left mouse button?
3
votes
0answers
104 views

Canvas element with 'width: 0' in OpenLayers 6 instance on Vue.js

I am using Vue components to generate multiple instances of OpenLayers in the same parent component. Ultimately I am attempting to export an image of each instance of OpenLayers using the html-to-...
1
vote
1answer
59 views

OpenLayers tiles size vs screen size

I'm using OpenLayers v6.1.1 and I would like to ask you to confirm that my understanding is correct. Take a look at below image: Am I right that there might be a situation that if I would take all ...
2
votes
1answer
57 views

Getting tile URL in OpenLayers

I'm using Openlayers v6.1.1 and I'm trying to get URLs of all tiles in the current map extent. I was trying to do it in the following way: var tileUrlFunction = tileSource.getTileUrlFunction(), ...
1
vote
0answers
136 views

WMS layer is displayed with ruined geometry in OpenLayers [duplicate]

I want to display a shapefile in OpenLayers using MapServer 7.6. It is shown properly in the browser using the mapfile's link. But when I try to display it in OpenLayers, the geometry is completely ...
1
vote
1answer
307 views

WMS GetFeatureInfo “TypeError: wms_layer.getFeatureInfoUrl is not a function”

I am trying to trigger WMS GetFeatureInfo requests on click. Like this example: https://openlayers.org/en/latest/examples/getfeatureinfo-tile.html but on a popup. As of now, I have the popup working ...
1
vote
0answers
490 views

OpenLayers 6.1.1 add layer to existing layer group in ol-layerswitcher

I have a productive site with OpenLayers 4.6.4 and want to switch to the actual 6.1.1 version. Since there where changes in the code I have to adapt mine to get everything work again. Actually I'm ...
1
vote
0answers
199 views

Can't display ONLY my GeoServer layer using OpenLayers 6 [closed]

I am having some trouble getting my OpenLayers 6 maps to display my own layer from GeoServer. The code below let me choose between OSM , Bing Map or CartoDb as a base layer and displays a default ...