Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [openlayers]

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

2
votes
1answer
90 views

Openlayers 5 scaleline has gives wrong results

I am using Openlayers 5 (modules from NPM) and I am having a problem with a scaleline in my map. // from https://epsg.io/2264.js proj4.defs('EPSG:2264', '+proj=lcc +lat_1=36.16666666666666 +lat_2=...
1
vote
1answer
245 views

Loading WFS GeoJSON from Geoserver in Openlayers

I am trying to load a WFS JSON layer into my web map. I am running the web page on a MAMP server. The layers are loaded from Geoserver and from a POSTGIS database. I have 2 WMS layers being loaded ...
0
votes
2answers
461 views

Get GeoJSON from a database by the AJAX method for OpenLayers

I have this code: if (ol.proj.proj4 && ol.proj.proj4.register) { ol.proj.proj4.register(proj4); } var features = new ol.format.GeoJSON().readFeatures( $.ajax({...
1
vote
1answer
270 views

How to get extent of Image layer in OpenLayers?

Considering the code below (which uses openlayers and Viglino's ol-ext), how do I get the extent of the geoimg? var map = new ol.Map({ target: 'map', view: new ol.View({ zoom: 18, center: ...
1
vote
1answer
61 views

How to display TileWMS layer 0-360 degrees

i receive from geoserver TileWMS layer that have extent from 0 to 360 degrees, and when i load this layer on map i can see only part of layer, becose my map have extent from -180 to 180 degrees. How i ...
2
votes
0answers
269 views

OpenLayers: change cursor upon hovering over feature

I want to change the mouse cursor to a pointer when the mouse is hovering over a feature. I currently have the following: this.map.on('pointermove', evt => { if (!evt.dragging) { this.map....
0
votes
2answers
133 views

GeoServer WMS layer won't load on OpenLayers 5

I was making some tests using Tiger products: I converted one .shp in a PostGIS database using shp2pgsql, then imported the db into GeoServer; the layer works fine with the preview provided by ...
0
votes
1answer
67 views

Is vector tile a feasible option for dynamic data?

I want to create an application using vector tile. I am using OpenLayers 5 and GeoServer 2.14 for this purpose. My data (stored in PostgreSQL+PostGIS) has around 2.5 lakhs geometry (road network) ...
0
votes
1answer
45 views

How to calculate the Longitude and Latitude of rotated polygons in Openlayers3?

We are using external Transform library with Openlayers for the polygon scale,Translate and rotate actions. After rotating the rectangle/square/polygon, when we scale it, the shape is getting ...
3
votes
2answers
112 views

Making WMS GetFeatureInfo request gives Invalidpoint response?

When I make a GetFeatureInfo request to a WMS service, I get an invalid point response. I wonder what is missing from my request. My Layer definition : var Parcels = new TileLayer({ name: '...
1
vote
1answer
71 views

In OpenLayers how do I prevent linestrings and polygons disappearing as I zoom out?

I can see how to do this using a feature style function with 2 styles (similar to the Custom Polygon Styles example). One would be the normal linestring/polygon one and used at high enough zooms. The ...
2
votes
2answers
815 views

Unexpected token Identifier error - Import OpenLayers

I'm trying to use some OpenLayers libraries in my code, and called him in JavaScript like this: import Map from 'ol/Map.js'; import Overlay from 'ol/Overlay.js'; import View from 'ol/View.js'; ...
1
vote
2answers
203 views

Import from in Openlayers

I'm looking for some examples in OpenLayers to add in my project, and all those examples had something like this in their JavaScript:` import Map from 'ol/Map.js'; import Overlay from 'ol/...
0
votes
0answers
65 views

GeoServer WMS layers (with data) on same region of OpenLayers 3

There are 3 layers (image and tile) from GeoServer and sits on top of each other. Now I need to read data from these three different layers in UI (jsp). <%@ page language="java" contentType="text/...
0
votes
0answers
47 views

Can OpenLayers show map in projection other than wgs84 or UTM, for example Albers projection?

I've managed to show map in both utm or wgs84 in OpenLayers but Albers projection seems not possible as it does not have bound? Not sure about this, might be what I'm doing is wrong.
2
votes
1answer
124 views

OpenLayers: prevent map from resizing [closed]

We are using OpenLayers on mobile devices. When ever the keyboard is shown, OpenLayers resizes the map. This gives us performance issues when there are many features on that map. It takes a long time ...
0
votes
0answers
56 views

PerpendicularOffset is not working for vector tile

I want to create an application using vector tile. I am using openlayers v.5 and geoserver 2.14.1 for this purpose. In geoserver SLD i have added OGC filter which filters geometries on the basis of ...
1
vote
1answer
197 views

How to get bounding box of WMTS request

I want to create an application using vector tile. I am using openlayers v.5 and geoserver 2.14.1 for this purpose. I have already rendered vector tiles, but not able to get bounding box of the vector ...
1
vote
1answer
92 views

Select Features in qgis2web - openlayers

After using qgis2web to export a map, I am looking to modify the qgis2web.js file to have the possibility to select (highlight) features on click and keep them selected until I click somewhere else (...
2
votes
1answer
180 views

How to snap to a geojson-vt layer (Vector Tile Layer)?

I'm using geojson-vt to render a large geojson (originated from OSM) file. This file contains all road from a state (extracted with overpass-turbo way[highway="*"]). I'm buinding a domain-specific ...
1
vote
1answer
70 views

How to avoid empty popups when GetFeatureInfo request is empty

I set up a WMS with QGIS SERVER. I am querying it via a web app based on OpenLayers. Everytime I click on my map, I send a GetFeatureInfo to a specific layer passing the coordinates where I clicked, ...
1
vote
2answers
187 views

How to pass viewparams with vector tile request using open layers 5

I want to create an application using vector tile. I am using openlayers v.5 and geoserver 2.14.1 for this purpose. I have already rendered vector tiles, but not able to pass viewparam along with ...
2
votes
2answers
190 views

GeoJSON put in the OpenLayers maps

I am a beginner in OpenLayers. I would like a GeoJSON to be displayed on the map. Can you provide me with some example code to allow me to build this small project? The GeoJSON code is: {"type":"...
1
vote
2answers
108 views

Reloading OpenLayers 5 WMS automatically with new data

I am making a weather application. It is almost finished now, but I just have one problem left. I want a WMS-layer to automatically reload every few seconds. I thought I had the solution, but it seems ...
0
votes
0answers
28 views

How to handle Update error: Transaction does not have authorization for mytable3:mytable3.5?

I am building collaborative mapping app using openlayers 5.3.0, geoserver 2.14.0 and postgresql 10.4. I want the user to be able to update features using wfs-t but before updating, the user needs to ...
0
votes
0answers
54 views

Writing custom control for OpenLayers 4?

I have a single static chart (built with ChartJS; it's displayed on a canvas) and I would like to have it as a collapsible control button that could be toggled (just like the map overlay or ...
2
votes
1answer
50 views

Changing apparent scale of tile layers [closed]

There's loads of web-based tile layers out there which are great in many ways, but one problem I'm having is making them look nice when exporting a map to print or as a jpeg. The problem consistently ...
0
votes
0answers
29 views

Loading tiles while interacting for a single layer

loadTilesWhileInteracting option applies to ol.Map. Is it possible to have that effect only apply to a selected layer?
2
votes
1answer
557 views

How to detect zoom change in OpenLayers

There is no appropriate zoom event listener in OpenLayers v5.3 yet, but there is a workaround suggested in this ticket: You can use this.view.instance.on('change:zoom', evt => console.log(this....
4
votes
1answer
210 views

Vector layer does not appear with OpenLayers

When I import the vector it simply does not show in the map. I tried with a raster and it worked fine. I tried now with both KML and GeoJSON and the same thing happen, I can see that it loaded in the ...
0
votes
1answer
197 views

Union GeoJSON polygons

I'm using OpenLayers and give some try on Turf.js, but with no result. I've an array with several GeoJSON string and I want to merge them all. (Below an example of just one element of my array that ...
0
votes
1answer
53 views

OpenLayers VectorLayer from GeoServer wont show up

I have a SQLServer database containing geospatial data, have created layers from those data in GEOServer and it works fine, I'm working on a webgis application to allow users select features on the ...
0
votes
1answer
35 views

Animating layer in OpenLayers4

Is there a way to include animate properties of a vector layer (GeoJSON)? var highlightStyle = new ol.style.Style({ stroke: new ol.style.Stroke({ color: '#fff', width: 1 }), ...
0
votes
0answers
23 views

Openlayers4 ol.layer.Group only gets first item

I am trying to change the opacity of vector layers using one slider but I seem not to get the right logic to loop each item as opposed to just the first. Here is my code so far. Link to full code ...
1
vote
1answer
99 views

How to calculate TilesOrigin for WebGeoCache in OpenLayers

I'm using OpenLayers 5.2 to display tiles from Geoserver 2.14 with GeoWebCache. For the GeoWebCache to work it is required to define tiled=true and tilesorigin parameters in the WMS requests. How to ...
4
votes
1answer
180 views

Mismatch between OpenLayers 5 and XYZ-layer on some zoom-levels

I have an image pyramid that I created with gdal2tiles. Then I displayed this layer on top of another map in OpenLayers 5 with the XYZ source. On the map zoom levels 0-8 the XYZ layer is not aligning ...
0
votes
2answers
58 views

Duplicate labels in ArcGIS Server REST map service OpenLayers 5

I'm trying to export PLSS grid from ArcGIS map server and I have a duplicate labels in PLSS map service. Using OpenLayers 5 My code mapPLSSTownshipLayer = new ol.layer.Tile({ extent: [-...
1
vote
0answers
22 views

WFS how to consume with different coordinate system? [duplicate]

I have a WFS in EPSG:4167. My map view has EPSG:3857. How to make the WFS work on a map view with different coordinates? I used this to define my coordinate system from wfs: import { register } ...
3
votes
3answers
196 views

Why is there a transformation shift/distortion of ~1.5km in OpenLayers 5.3.0 going from EPSG:4326 to EPSG:3857?

I have two features in plain WKT format, the source coordinates being in standard EPSG:4326 projection. I use these features to run some intersection operations, and I'm troubled by the fact that in ...
0
votes
1answer
43 views

Using JavaScript to manipulate the display of GeoJSON on Openlayer4

I am loading a number of geojson data (all polygons) and using 3 sliders, the user should be able to get a polygon displayed based on the slide value. Here is an online example of what I intend to ...
0
votes
0answers
48 views

Label color complementary to background map layer color in OL5

I'm looking for an optimal method in OL5 to automatically set the color of each feature's label (fill or stroke of ol/style/Text) depending of the local color of the TileLayer under the label. The ...
0
votes
1answer
143 views

OpenLayers Linestring does not draw straight images

My problem:Add image along the LineString My problem has been solved here, but when I add a 32x32 image and I draw between two points, the images in the line don't go straight and there's a slight ...
0
votes
1answer
209 views

How to overlay a raster using OpenLayers?

Through the example provided by the examples section of the OpenLayers website I was able to replicate the overlay method of an image. But when I try to add a different raster, now present in the ...
2
votes
1answer
236 views

Drawing a GeoJSON with D3js on OpenLayers 4

The goal is to interact with the DOM based on users input using JavaScript. I have now considered using D3js (v5) to draw the points. Without the base vector layers (loaded as a geojson) and ...
0
votes
1answer
92 views

OpenLayers 3 - display layer WFS in EPSG:4326

I have to display a layer from a WFS service (http://wms.pcn.minambiente.it/ogc?map=/ms_ogc/wfs/Bacini_idrografici.map) using OpenLayers 3.x API (..there's a reason). The WFS service is exposed in ...
3
votes
1answer
75 views

Openlayers 5 - Does NPM Add Features?

I'm looking at a project and trying to determine if from a features standpoint if I will lose anything by just pointing to the CSS and JS files for OpenLayers like https://openlayers.org/en/latest/doc/...
0
votes
1answer
113 views

GeoTIFF rendered in OpenLayers using GeoServer: Tiles have different brightness and sharp edges between them

I have a script that download and process satellite images using pyhon/gdal and then upload them to GeoServer. The basic process is: gdalbuildvrt tmp.vrt file_1.tif file_2.tif ... file_n.tif ...
0
votes
0answers
55 views

Importing OL5 files in NodeJS

I need to import things from OpenLayers-5 into my NodeJS application so that I can show the WMS-layers I made with GeoServer. It seems that there is no way around NodeJS with Express if I want to ...
1
vote
1answer
188 views

OpenLayers Multi-line drawing lines disappear

I've written code for plotting multiple linestring. I draw lines according to the distance entered and the number of lines. But in some cases, the lines start to disappear after a certain ...
0
votes
1answer
50 views

wrong track building with openlayers

faced with the situation when ol draws lines if the coordinates are "scattered". for example. coords as is: and sorted coords by date: bottom image is almost correct except sharp lines up. ...