Questions tagged [openlayers]

Use when the version you are using of the OpenLayers JavaScript client toolkit is 3 or later

Filter by
Sorted by
Tagged with
0 votes
0 answers
11 views

Use of ratio in ImageWMS in OpenLayers

I am trying to understand the setting of ratio in ol.source.ImageWMS but I am not succeeding. I already understand the ratio: 1, as there is not much to understand there. ratio: 1 = browser viewbox. I ...
user avatar
  • 81
0 votes
1 answer
19 views

OpenLayers 6 custom control using Vuetify and a resizable div

I am trying to understand how to extend the Control class of a OpenLayers 6 map using Vuetify components inside. I have several ideas to implement such as a collapsable search bar or a simple ...
user avatar
  • 11
1 vote
1 answer
20 views

OpenLayers import CspLine with KML

I'm using the following code to draw ol-ext cspline in my OpenLayers project. <!-- index.html --> <!DOCTYPE html> <html lang="en"> <head> <meta charset="...
user avatar
1 vote
1 answer
24 views

Toggle dark mode on and off using on and un in OpenLayers

I made this codepen where I am setting a style to a layer on an event listener. My question is simply how can I programmatically toggle the styling on and off since my attempts to unlisten to the ...
user avatar
  • 11
0 votes
0 answers
19 views

Catch the crop data in ol.source.ImageWMS?

How can I catch the crop data (in pixels) from the ol.source.ImageWMS? The function sends only the WIDTH and HEIGHT data to the WMS server. I need the crop data (in pixels and in left,bottom,right,top)...
user avatar
  • 81
0 votes
0 answers
40 views

Transform coordinates length to pixel length?

Is there a function to transform a coordinates length to a pixel length? I need this function for cropping and scaling map images to be inserted as layers in an OpenLayers Map. The map images are ...
user avatar
  • 81
0 votes
0 answers
14 views

OpenLayers noticable freeze when loading features

My application loads data from REST api as array of JSON objects. Application is a mix of standard UI with map capabilities, so each object contains standard fields as well as geometry as WKT. ...
user avatar
0 votes
0 answers
12 views

Displays a list of a layer elements [closed]

I set up an offline map with OSM and Geoserver data, and I need to add a number of features with OpenLayers, including selecting a layer (such as a bus stop layer) and displaying all of its elements (...
user avatar
1 vote
1 answer
44 views

Change the color of map elements with a unique ID

How can I change the color of a point or a Line by choosing its unique idea? The problem is that this choice must be possible for several elements at the same time and these IDs are sent from the ...
user avatar
-1 votes
0 answers
14 views

Using maps from tpkx file [closed]

I am tasked with developing a web app for a client, which will include a map component. The client will supply the maps in a .tpkx file format. What are ways to display the maps through OpenLayers or ...
user avatar
  • 27
0 votes
1 answer
33 views

OpenLayers trigger map click on specific coordinates

I am working with web map application Lizmap which unfortunately is working with OpenLayers 2. I want to trigger map click programically on specific position: let event = new Event("click"); ...
user avatar
1 vote
0 answers
21 views

Strange white filling of new added Vector layer in OpenLayers map

I generated an OpenLayers map project using the qgis2web plugin. I would like to add the new Vector layer using the WKT polygon geometry. In the following code geomLine is WKT Polygon. Nevermind, when ...
user avatar
  • 33
0 votes
0 answers
54 views

OpenLayers vector accuracy in EPSG:3857 projection

I'm working on a web mapping solution that stores data in PostGIS with EPSG:4326 projection. Everything seems to be good until last week. My customer loaded two shapefiles that some parts are ...
user avatar
0 votes
0 answers
27 views

OpenLayers Google Satellite error

When I try to insert in QGIS the Google Satellite OpenLayers Plugin it gives me an error ("Printing and rotating of JavaScript API based layers is currently not supported" and the image ...
user avatar
  • 11
1 vote
1 answer
40 views

OpenLayers GeometryCollection styling issue

With some help, I am able to draw some custom shape on my OpenLayers project with the following code. geometryFunction = function (coordinates, geometry) { const center = coordinates[0]; ...
user avatar
2 votes
0 answers
33 views

Enable to display OpenLayers maps correctly in REACT JS app

Here is my code: import React from 'react'; import { Map, View } from 'ol'; import TileLayer from 'ol/layer/Tile'; import OSM from 'ol/source/OSM'; import 'ol/ol.css'; export default class App ...
user avatar
1 vote
0 answers
34 views

Legend layer - displayed on each tileWMS (OpenLayers)

I have a strange symptom when add legend to layer WMS (OpenLayers v.6.14.1). The same layer display via GeoServer - everything it's ok. How to avoid display legend on each tile at WMS layer? Should ...
user avatar
  • 11
2 votes
0 answers
25 views

GeoServer ImageMosaic OpenLayers strange layer duplication at Scale = 1 : 34K [closed]

I have made a simple ImageMosaic out of 2x GeoTIFF (+ .ovr +.msk for each). In the map preview at Scale = 1 : 34K, the TIFFs are duplicating as per the image. This only happens at this zoom level. ...
user avatar
  • 31
0 votes
1 answer
26 views

GetFeatureInfo in OpenLayers only if the layer is visible

I'm using the following code in Open Layers 6, and it shows the feature info, even if the layer is not visible map.on('singleclick', function(evt){ document.getElementById('info').innerHTML = '...
user avatar
  • 2,271
1 vote
1 answer
25 views

How to get layers name added to OpenLayers map v6.14.1?

I'm trying to get name of layers added to OpenLayers v6.14.1, I found some methods but they were very old for instance: "map.layers" and one other method I found was : let addLayers = map....
user avatar
  • 791
0 votes
0 answers
33 views

OpenLayers 6 get features of vector tiles within polygon

I am trying to get all the features from VectorTile "ol/layer/VectorTile" which are within a drawn polygon using getFeaturesInExtent: Tile Layer const tileLyr = new VectorTileLayer({ ...
user avatar
0 votes
0 answers
41 views

Different response from GeoServer for WMS and vector tile data in OpenLayers

I have made a GeoServer basemap in WMS, and now I want to create a similar vectortile service - using GeoServer 2.20.0 and the vector-tiles plugin. Problem is that I get different outputs from ...
user avatar
0 votes
0 answers
18 views

How to config "tileLoadFunction" Openlayers v6.14.1 by axios in reactjs for adding WMS layers?

I'm trying to add GeoServer WMS layers to Openlayers map in reactjs, this is my code: setWMSLayers(wmsLayers=>[...wmsLayers, new TileLayer({ source:new TileWMS({ url:'...
user avatar
  • 791
1 vote
1 answer
31 views

Multiple sources for SearchFeature in ol-ext

I am using ol-ext to add a seach field for countries to my map like this: map.addControl(new ol.control.SearchFeature({ source: countriesSource, // of type ol.source.Vector property: "Name&...
user avatar
1 vote
1 answer
30 views

Accessing GeoJSON properties after loading the WFS features on the map

I use the following code to get WFS features on the map. let WFSlayer = new ol.layer.Vector({ title: layer, source: new ol.source.Vector({ url: "/proxy/?layer_name=" + layer +...
user avatar
1 vote
0 answers
40 views

Fetch vector tiles after zoom/pan ends in OpenLayers 6

I am trying to optimize the vector tile loading from my local server. Is there any way or any tileLoadFunction to fetch the tiles only after zoom/pan ends. I am currently using the below function to ...
user avatar
0 votes
1 answer
34 views

How to animate view to custom coordinates in OpenLayers 5?

Given just a basic ol.Map using OpenLayers 5 var map = new ol.Map({ layers: [ new ol.layer.Tile({ source: new ol.source.OSM() }) ] target: 'map' view: new ...
user avatar
  • 311
1 vote
0 answers
27 views

OpenLayers Modify interaction in freehand mode

Is there any way to enable "freehand" mode with the Modify interaction? I am looking to edit the side of a simple polygon in freehand style. Is there any way to do this in OpenLayers or ...
user avatar
  • 365
2 votes
0 answers
29 views

How can I display WKT MultiLineString on OpenLayers in DJANGO project [closed]

I want to display WKT in text on HTML. I wanted it on JS variable but i couldn't do that. Python code def showResult(request): start = request.GET['start'] end = request.GET['end'] . ...
user avatar
0 votes
0 answers
37 views

Moving WMS overlay independently to match baselayer in OpenLayers

I made a webgis that manages WMS layers in different projections with OpenLayers 4 and proj4js. Sometimes (e.g. for historical maps) the overlay is not perfectly aligned with baselayer and a need a ...
user avatar
  • 94
0 votes
0 answers
38 views

How to display WKT MultiLineString on OpenLayers in DJANGO project

Actually i tried something but just i display WKT in text on HTML. I wanted it on JS variable but i couldn't do that. Python code def showResult(request): start = request.GET['start'] end ...
user avatar
0 votes
1 answer
47 views

Add EPSG:404000 WMS to OpenLayers

I am currently trying to add an EPSG:404000 WMS to my OpenLayer map. The map is using EPSG:4326 for it's projection. When I tried to use the following code, the url returns a 1x1 WMS, when it should ...
user avatar
1 vote
0 answers
27 views

ImageLayer with ImageWMS rendering (ol update from 6.2.1 to 6.13.0) [closed]

After updating OpenLayers I'm noticing a rendering change on an ImageLayer let newWMSLayer = new ImageLayer({ visible: true, source: new ImageWMS({ ...
user avatar
1 vote
0 answers
42 views

OpenLayers - Add PNG image static from local disk? [closed]

I have some layers in GeoServer, where I used the OpenLayers technology to act as a viewer for these. The code is the following: <!doctype html> <html lang="es"> <head> &...
user avatar
2 votes
1 answer
58 views

OpenLayers/Angular/ol-cesium : Point vectors show on both 2D/3D map / polygons don't

I am working on a existing app made with Angular 13. I use OpenLayers 6+ and the npm package ol-cesium. I have an Angular component where I display a map (2D - OpenLayers). Everything goes as planned. ...
user avatar
1 vote
1 answer
25 views

Plotting circle in OpenLayers: trouble with transformation

I am trying to display a circle on my OpenLayers map from radius and a centroid. The issue is that the transformation is not working as expected. My map projection type is defined here: proj4.defs(&...
user avatar
  • 143
1 vote
2 answers
50 views

OpenLayers won't display polygon (or line) with zero size

Using OpenLayers 6, my app will not display anything for a Polygon (or line) where all the vertices have the same coordinates. Being that the style being used has a non-zero line thickness, I would ...
user avatar
1 vote
0 answers
60 views

OpenLayers: draw a shape (square or circle) where the user clicks on map [closed]

In OpenLayers 6, using OSM, I'm trying to draw either a square or a circle where the user clicks on a map. The shape should be (around) 5km of side or radius. So far I've produced the following to ...
user avatar
  • 111
0 votes
1 answer
34 views

OpenLayers fullTileRanges of tileGrid no longer easily available in 6.13

Getting the details of a tileGrid was working fine in OpenLayers 6.5, but I've just upgraded to OpenLayers 6.13 and now the tileGrid keys are no longer available in plain English. Eg, keys such as &...
user avatar
0 votes
0 answers
37 views

Unregister listeners when calling map.removeControl

I use ol-ext Profile tool to display profiles along vector lines. When I call map.removeControl(profil); profil = null; to remove the profil, the listeners associated with the tool remain registered, ...
user avatar
  • 193
2 votes
1 answer
39 views

Deleting selected feature on alt+click in OpenLayers

Im trying to delete a feature on alt+click. The alt+click code works since i can print out the feature when i click on it. But, i thought i could simply remove it by using source.removeFeature(feature)...
user avatar
1 vote
1 answer
45 views

LayerSwitcher with sidebar, how to compress groups from radio buttons?

I use openlayers and LayerSwitcher with sidebar (https://github.com/walkermatt/ol-layerswitcher) Code: var mapAtt = new ol.Map({ target: 'map', layers: [ new ol.layer.Group({ ...
user avatar
0 votes
0 answers
41 views

When using GeoWebCacche, vector layer cannot display completely

Using GeoServer 2.19.0, I'm generating vector-tiles (formats:mapbox-vector-tile, SRS:EPSG:4326, Gridset:EPSG:4326) for the full extent of a layer. After Seed, I open a result page from web console, ...
user avatar
2 votes
1 answer
60 views

OpenLayers line labels with 'line' placement not working

Using OpenLayers 6.13.0, I'm attempting to get my lines layer to have labels that follow the line (ie, parallel to the line, and bending with the line) as per the example at: https://openlayers.org/...
user avatar
1 vote
1 answer
127 views

Styling feature depending on property and display it in OpenLayers?

I have a feature with multiple elements, every element has its own geometry and an ID. Is possible to change the style of the feature and display the elements of the feature on the map like it's own ...
user avatar
  • 45
3 votes
2 answers
98 views

"Unsupported GeoJSON type" from AJAX request to PostGIS database

I'm trying to use a GeoJSON to build a layer on an OpenLayers map of MultiPolygons from my PostGIS database. However the following error is thrown: Uncaught Error: Unsupported GeoJSON type: undefined ...
user avatar
3 votes
1 answer
71 views

Dynamically fetching only related values instead of all attribute values in dropdown from GeoJSON in OpenLayers

I have a vector layer in GeoServer which basically has 14 line/fields/polyline attributes I want the list of only those stations in the 2nd dropdown of end station which are actually related Like 5 ...
user avatar
0 votes
0 answers
41 views

Accessing GeoServer on own domain (Windows OS)

I installed an GeoServer on my laptop with MS Windows installed. I wish to access a WFS or HTML file through "localhost/geoserver/" rather than "localhost:8080/geoserver/", the WFS ...
user avatar
1 vote
2 answers
72 views

Showing legend/classified features in OpenLayers from qgis2web?

How can I show legend / classified features in my layer switcher legend in OpenLayers from qgis2web similar to how the Leaflet option exports it? Openlayers shows legend items fine as a single style ...
user avatar
3 votes
1 answer
72 views

GeoJSON will load from variable, but not from file in OpenLayers

I'm trying to add a point to my open layers map from a file. To start with I loaded the json data from a variable. var data = '{ "type": "Feature", "geometry" : { "...
user avatar
  • 143

1
2 3 4 5
67