Questions tagged [openlayers]
Use when the version you are using of the OpenLayers JavaScript client toolkit is 3 or later
3,665
questions
0
votes
0
answers
8
views
OpenLayers area is not matching with QGIS
I have a geometry in New Zealand which is giving area as 425991 I tested this is
EPSG:4326
EPSG:3857
EPSG:2193
on QGIS and random online tool as well.
But when I'm trying to get area of same polygon ...
0
votes
0
answers
17
views
Failing to load COG as tiles with CDN OpenLayers?
I have a 250 MB, 9 band Cloud Optimized GeoTIFF in an Azure Container which I am trying to retrieve overviews from to display in a browser with CDN OpenLayers, but I keep running in errors with every ...
1
vote
1
answer
18
views
Getting stable polygon geometry values from an MVT-format VectorTileLayer in OpenLayers?
I am trying to identify points inside polygons using Turf.js in combination with OpenLayers 9. The polygons I show on my OpenLayers map load a lot faster if I use VectorTileLayers with a format of MVT ...
0
votes
1
answer
16
views
Can you fetch VectorSource data before setting it on the VectorLayer in OpenLayers?
Working in OpenLayers 9, I'd like to avoid a blank map while I change the CQL_Filter of a VectorSource and refetch data to populate an existing vector layer. Currently, my code works like this:
//Get ...
0
votes
0
answers
21
views
VectorLayer vs VectorTileLayer feature.getId() differences in OpenLayers 9 + GeoServer
I'm perplexed on why the IDs of my features are formatted differently depending on if I create a VectorLayer or a VectorTileLayer out of the same set of features. It's possible this has to do more ...
1
vote
0
answers
33
views
Dynamically filter points layer data with one or more filter values through style variable in OpenLayers?
I have created layer using WebGLPointsLayer with flatstyle. I want to build functionality to where user can apply filter to filter data on map.
Below are the scenarios: When user has not selected any ...
1
vote
1
answer
74
views
Use PostGIS data with node.js, Express.js in OpenLayers
I've followed the quick start guide from OpenLayers to build a new app using
node.js. So I have now a nice OSM Map (index.html + main.js), where I added already a few backgroung layers and a ...
0
votes
0
answers
22
views
Adding image with given extent and given projection string to OpenLayers fails
Given an image, I have the following data provided:
Citing/translating the docs: "The proj-string for the grid in the WGS84 earth model is:"
+proj=stere +lat_0=90 +lat_ts=60 +lon_0=10 +a=...
1
vote
0
answers
21
views
ScaleLine and measurement value is not matching in OpenLayers 10
I'm creating a map with EPSG:4326 project and I have added Scaleline as follows
const scaleControl = new ScaleLine({
units: 'metric',
bar: true,
steps: 4,
dpi: 96,
text: true,
minWidth: ...
1
vote
0
answers
31
views
OpenLayers 8.2.0 custom addCoordinateTransforms
I want to apply a localization to my view after I project it to a state plane. I can use proj4 and project to state plane, but when I try to do this manually through addCoordinateTransforms, I just ...
0
votes
0
answers
27
views
Openlayers Icon draggable on whole image not only anchor
I'm using a transparent marker with a cross on the center to add new features (trees) on a map. The marker should be draggable on the border, so that the user can position the cross exactly on top of ...
0
votes
0
answers
23
views
Performance in OpenLayers 9: Add/Remove Layer or setVisible=True/False?
Let's say you have multiple checkboxes where a user can toggle on and off multiple different layers on the map.
Would you instantiate your map with just those that you know you want to be visible, or ...
0
votes
1
answer
48
views
How to eliminate blank spaces in qgis2web layer-switcher
I am creating a web map using the qgis2web plug in (version 3.24) exporting the map in openlayers. I’ve added a title to the legend but I get blank spaces between the groups. I am not sure if I have ...
1
vote
0
answers
68
views
Is azimuth preserved in EPSG:3857?
I am trying to draw the outlines of drone images using OpenLayers. The drone has recorded a "yaw degree", which should be the azimuth. However, when I place the rectangles on the map, their ...
0
votes
0
answers
66
views
Modifying ol3-search-layer functionality in an OpenLayers map exported from QGIS2web
I have a mapping project to document my tree collection at https://whisperingweevil.com/map/map.html
I am using QGIS and QGIS2web to generate code for my web map. I have a search field to search the ...
0
votes
1
answer
68
views
When WMS renders grids, areas with no data are rendered in the color corresponding to the '0' value
2024/6/25 Rephrasing the original question
I have published some single-band rasters as an ImageMosaic and exposed them through a WMS (Web Map Service). When I load this WMS service using OpenLayers (...
0
votes
0
answers
43
views
OpenLayers - disable control that includes clicks on the map
In my project I have several controls that interact via clicking on the map so I have to deactivate them selectively to use one at a time.
What is the correct method to deactivate a control that ...
0
votes
1
answer
134
views
Position the labels centrally in qgis2opengis / qgis2web (OpenLayers)
In my case: qgis2opengis export
(problem also with OpenLayers export from qgis2web)
As it is not possible to make settings for label positioning via QGIS, editing must be carried out in openlayers ...
0
votes
1
answer
86
views
OpenLayers 9, distance between lines
The getDistance method of OpenLayers expects two points. I couldn't find a generic method for lines, so I made the following:
import {getDistance} from 'ol/sphere';
export default class Utils{
...
0
votes
0
answers
35
views
Passing style to GeoServer layer group
We have two layers from PostGIS views defined in Geoserver Layers,
the district layer will be overlayed on the point layer,
and we defined the point layer with total three styles,
we are able to pass ...
1
vote
1
answer
57
views
Basemap with one selector
I would like the base maps to have a single selector instead of the classic check that turns it on and off, is it possible as in this figure?
0
votes
1
answer
55
views
Groups within group on qgis2web
I have several layers of polygons, each have defined symbologies. I want to make some layers merged into one group and then put it as a subgroup in another group.
Now when I export this on qgis2web ...
0
votes
1
answer
53
views
Subgroup toggle in qgis2web
When you export a map to a webmap through qgis2web, you have a checkbox in the legends to toggle on/off each layer. However, I have a categorized symbology and I want to be able to put checkboxes on ...
0
votes
1
answer
83
views
Polyline from coordinates array in OL v9.2.2
I'm trying to implement something like this example in Angular 17. I can't replicate this part:
const polyline = result.routes[0].geometry;
const route = new Polyline({
factor: 1e6,
}).readGeometry(...
1
vote
0
answers
51
views
Control feature order or z-index for WebGL layer icons? (OpenLayers)
I want to control the order icons appear on a WebGL layer so icons in the north appear in the back and overlap to the front as they appear southwards.
Since the WebGL layer does not have a renderOrder ...
0
votes
1
answer
33
views
OpenLayers zoom to WMS result set
I am using GeoServer with a plugin for a NoSQL backend. I am sending the equivalent of a CQL query to select a portion of a dataset and plot in on the map... like thousands of points. My plotting and ...
1
vote
1
answer
254
views
How to apply style array to WebGL points layer (OpenLayers)
How can I apply an array of styles to a WebGL Points layer in OpenLayers? For example, if I use the following code to apply a circle and an icon, only the icon is visible - so is what I want to do ...
0
votes
0
answers
97
views
How to remove GeoTIFF overlays certain geometry on the map
As shown in the below posted code, I instantiate an object from GeoTIFF class with configurations shown below. At run time, the tiff image overlays the desired geometry, but I can not remove it.
In ...
1
vote
1
answer
60
views
Panning during draw interaction breaks tracing of the draw interaction in OpenLayers
I have a draw interaction where I draw on an existing linestring feature in an Angular application. I start the draw interaction with tracing active to this linestring. When i pan after starting the ...
0
votes
1
answer
87
views
Eliminate any pixel of a GeoTIFF that does not intersect with the geometry/feature in OpenLayers?
As shown in the below posted code, I am trying to overlay particular geomerty/feature with a GeoTIFF, the code posted below succeeded in achieving that. However, as shown in the below posted screen-...
0
votes
1
answer
99
views
How to accommodate geotiff overlays a geometry/feature on the map
as shown in the below posted screen-shots, the one titled digit-area represents the geometry the user selected on the map.
for the one titled tiff-overlay it should represent the geotiff repective to ...
0
votes
0
answers
50
views
How to overlay the map with blob object of a TIFF file
As shown in the below posted code, I am trying to instantiate an object from GeoTIFF class and set a blob to the blob object. The blob contains data as shown in the section blob contents below.
When I ...
0
votes
0
answers
52
views
Uncaught TypeError when adding OpenLayers Measure tool to App
I am trying to add the Measure tool from Examples to my map application and keep getting the following error.
Uncaught TypeError: Cannot read properties of undefined (reading 'getLayers')
at ...
0
votes
0
answers
92
views
How to overlay the map with a TIFF file
As shown in the code posted below, I have a .tiff file and its path is stored in pathToTIFF variable, and I want to have it overlaid on the map.
At run time, the below posted code crashes and i ...
0
votes
1
answer
43
views
Openlayers 4.6.4 version vector layer with 150 features not working when we dynamically set text only in Chrome laptop/ PC
I have map with a layer consists of more than 150 features. I'm setting text dynamically for each features. For some reason, the texts are not rendered as expected only in Google Chrome of laptop. I'm ...
0
votes
2
answers
171
views
Change style for selected feature in OpenLayers
I need to change the style of the selected feature and allow the user to also change all features if they do not have any selected.
My problem is when the user set the new style, all the features have ...
0
votes
0
answers
31
views
Can the properties of the Snap event tell why sanp event lister call back does get executed despite snapping occures to edges and vertices
I register for Draw, Modify and Snap interactions as shown below in the code. The interactions added to the map are working except the Snap.
to debug this issue, i printed the contents of this.#...
0
votes
0
answers
65
views
MapProxy and Mapnik missing layers for some tiles only
I'm using MapProxy to serve OSM tiles rendered by Mapnik and displaying them using OpenLayers; in general it seems to be working but the problem is that at all zoom levels some of the tiles seem to be ...
1
vote
1
answer
232
views
Transform GeoJSON from EPSG:31983 to EPSG:4326 in OpenLayers
I have code in OpenLayers, which allows you to draw geometries on a layer and then download the file in GeoJSON format.
Here's the code:
function downloadGeoJSON(content, fileName, contentType) {
...
1
vote
1
answer
76
views
Snap interaction not working before first point drawn in OpenLayers
I'm trying to add snap interaction to map using OpenLayers. Snap works on draw but only after drawing first point of polygon. Is there a way to make it snap while starting to draw the polygon? I tried ...
1
vote
0
answers
59
views
OpenLayers add GML32 to map doesn't work
I'm new to this forum, but was thinking someone here could probably help me out.
I recently moved from using leaflet to using openlayers. For a new project I want to display the content of a gml file ...
0
votes
1
answer
39
views
Cannot set a style to a feature in OpenLayers
As shown in the below posted code, I am trying to make a feature invisible to the user.
At run time, I receive the error posted below.
Why am I getting this error and how can I solve it?
code
this.#...
0
votes
1
answer
77
views
Show designed map tips instead of the default pop-ups in qgis2web
I continue designing my customized interactive map using the latest version of qgis2web plug in. In this location, I want to display in the exported qgis2web map the map tips I designed with html in ...
1
vote
1
answer
55
views
Feature disappears when setting a buffer to a drawn feature with turf.js in OpenLayers
As shown in the code posted below, I am using turf.js to buffer a geometry.
The code below shows the steps I took to do the geometry buffering.
In the following step:
const asOLGeom = ...
0
votes
1
answer
66
views
Snap event does not get fired in OpenLayers
I create a snap event as shown below in the code.
At run time, when I hover the mouse near by a vertex, the mouse pointer gets snapped/attached to that vertex but the snapevent did not get fired.
...
0
votes
1
answer
65
views
Uncaught TypeError: wmsLayers.getSource is not a function
wms appears but when clicked an error appears like this and the popup does not appear
I want to use WMS GetFeatureInfo (Tile Layer) whose info is taken from WMS Geoserver to display popup information
...
1
vote
1
answer
47
views
OpenLayers snap to multipoint layer
Implementing snap interaction by getting snap points as features in layer. The draw interaction does not snap to displayed nodes. What is wrong?
snap_nodes = MULTIPOINT((350095.29 650021.37),(350097....
1
vote
1
answer
39
views
Adding Multipoint layer OpenLayers for snap interaction
I am trying to implement snap on my map, getting snap nodes as a multipoint wkt as snap_nodes and creating and adding a layer, but the layer doesn't show
snap_nodes = MULTIPOINT((350095.29 650021.37),(...
0
votes
0
answers
45
views
OpenLayer setTileLoadFunction gives Access-Control-Allow-Origin error
If I load the same source without the setTileLoadFunction it works fine, but if I load the same tile thru the function below as described in the documentation (https://openlayers.org/en/latest/apidoc/...
0
votes
0
answers
15
views
Recent upgrade to 2.25.0 - the OpenLayers map preview not working anymore [duplicate]
Recently we upgraded GeoServer from the stable release Dec 2023 (forgot the number) where everything was working fine to the March 19 stable release. The trouble is the OpenLayers preview shows just &...