Stack Exchange Network

Stack Exchange network consists of 174 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
Make your voice heard. Take the 2019 Developer Survey now

Questions tagged [openlayers]

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

0
votes
0answers
18 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
32 views

Changing apparent scale of tile layers [on hold]

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
15 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
42 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....
1
vote
1answer
30 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
36 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
36 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
31 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
17 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
34 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
96 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
1answer
29 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
19 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
96 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
35 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
27 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
111 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
44 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
54 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
64 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
48 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
39 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
28 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
73 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
30 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. ...
0
votes
0answers
33 views

GeoServer & GeoWebCache - Issues with tile origins when setting alignTopLeft=true for a gridSet

I'm finding an unexpected behavior when setting alignTopLeft=true at geowebcache.xml for a gridSet. When I am navigating on the map within the same cache level everything works fine (even zooming in/...
0
votes
0answers
44 views

OL5 functions in JavaScript not working with NodeJS

So I made a weathermap with GeoServer and OpenLayers5. Works fine and all, but NodeJS keeps giving me a hard time. Does anybody know how this really works? Because I need input from the end-user, ...
1
vote
0answers
10 views

OpenLayers store layer in a cookie [migrated]

I'm refactoring the whole code into modules and I'm facing a problem accessing a variable from an iframe. Basically I have a map where you can draw features and when you want to print you click on a ...
1
vote
0answers
46 views

Print Openlayers WMS map with fixed scaling

I need to print a map with a fixed scale (1:500 and 1:1000) on A4. The online map is done with Openlayers, the print request is sent to QGIS Server using WMS getPrint function. I mange to get an ...
1
vote
0answers
19 views

Setup for several origins for a WMTS in OpenLayers

I´m trying to setup a map with a WMTS as a layer with help form this example: https://openlayers.org/en/latest/examples/wmts.html The layer works fine for the first three levels, but after the third, ...
0
votes
0answers
19 views

How we can get respective WMS layer from a WFS layer?

We need to get the respective WMS layer here, ArcGIS Server WMS layer names do not match to WFS names so name matching doesn't work import org.geotools.data.DataStore; import org.geotools.data.ows....
1
vote
1answer
40 views

Removing shapes on a mouse click - Angular 6

So I can remove a layer fine, and I can see how I can remove a feature(shape) by grabbing it's id lets say and populating the list of current features for the user to select. But ideally I want to be ...
0
votes
1answer
15 views

Openlayers 4.6.5 Drawing not populating on map

The code is as follows @Input( 'coreMap' ) coreMap :CoreMapComponent vectorLayer : VectorLayer; modifyLayer : Modify; draw: Draw; vectorSource: VectorSource; style: Style; snap: Snap; ...
0
votes
1answer
15 views

OpenLayers 4.6.5 addLayer circular structure & layer.getLayerArray is not a function

Currently working with OL 4.6.5 and Angular 6 and for the life of me have read the documentation and API references on the OL site http://openlayers.org/en/v4.6.5/doc/ And despite following there ...
0
votes
1answer
62 views

Openlayers 4 custom pop-up for a GeoJSON layer

I need to get popups showing for just a single feature layer (forest -- stored as a GeoJSON) as opposed to all in Openlayers. I currently have the below. var map = new ol.Map({ target: "map", ...
0
votes
1answer
25 views

OpenLayers v5 XYZ source is making 'wrong' requests

I'm trying to add a tilelayer to a map, but the zoom level and x/y coords are not matching up in the network request for some reason. Here's my code for the layer: new TileLayer({ source: new XYZ({...
0
votes
1answer
31 views

Load WFS from ArcGIS Online on OpenLayers 3

My goal is to load several shapefiles and display them using OpenLayers 3 as the basemap. I now have these shapefiles as a Web Feature Service (WFS) on ArcGIS Online. Below is what I have done (...
1
vote
0answers
48 views

Selecting WMS layers from GeoServer in OpenLayers application?

I am making a weather application and I am almost there! I can show my GeoServer WMS-layers in my browser using OpenLayers 5. What I want to accomplish is that the user can switch between different ...
-2
votes
1answer
48 views

Openlayers 5 click vector feature style circle popup [SOLUTION!] [closed]

there is already a working script for OL 3. https://next.plnkr.co/edit/DXnDfStbvbetOtdU Is there anyone who can rewrite that in OL 5? Please as in the example for OL 3 without Ajax, JQuery and ...
2
votes
1answer
243 views

Add image along the LineString

I am wondering how to place images on a line. For example, instead of a dotted or dashed line. I could include a symbol of a cloud a character (e.g. |) repeated along the line. it cannot show the ...
1
vote
2answers
23 views

Remove/Delete a layer or layergroup with mouse click

I add a ol.layer.Vector OR ol.layer.Group with a mouse click in the map. By a new mouse click should the layer removed/deleted AND a new layer should be add. etc. I have search and search and don't ...
1
vote
1answer
52 views

How to truncate coordinates (LonLat) to decimal precision - OpenLayers 2

For eg. if coordinates are 17.12345678, -82.12345678, And I want to convert them to 3 decimal digits Expected result: 17.123, -82.123 Is there any API in OpenLayers 2 to truncate coordinates (...
1
vote
0answers
36 views

Leaflet - two colors same path

Wanted to know if is there a way to get a single path (line) to have 2 colors? for example one next to each other I want to display 2 different paths (multi poly-lines) at same times, and each one ...
1
vote
2answers
32 views

Zooming openlayers map to fit in selected features

In my openlayers based application, I need to trigger zoom when user selects features so that all the selected features fit within the map extent. I make use of this code: map.getView().fit([swLong, ...
0
votes
0answers
22 views

OpenLayers feature opacity vs zIndex

I'm using OpenLayers 4.6.5. I have a VectorLayer with a couple of circle features that have the same zIndex. The problem is, that the features texts are overlapping although I've set the the opacity ...
0
votes
2answers
52 views

OpenLayers flip coordinate order for BBOX WMS request

I have a WMS layer which have a different axis-orientation to the one that OpenLayers sends out in the BBOX-request. Openlayers uses the BBOX (minx,miny,maxx,maxy): BBOX=1438239.124213878%2C7895639....
0
votes
0answers
16 views

Openlayers 4 ScaleLine not visible

I am debugging a problem in an openlayers-based map application. Some time ago the ScaleLine control stopped being shown and I cannot find why. In the code below, if I change the units to degrees, the ...
0
votes
1answer
26 views

Interacting OpenLayers with GeoServer

I am new to OpenLayers. I need guidance on below. I am able to create map using OpenLayers and able to create polygon interactions on the map and able to extract as GeoJSON object with coordinates. ...
1
vote
1answer
46 views

Color blurring on GeoServer WMS layer loading using OpenLayers 5

I am using GeoServer 2.14.1 and OpenLayers 5 API to view the polygon data to my web map application using WMS service. I have used simple polygon style with black color.When zooming, the color of the ...
0
votes
0answers
20 views

OpenLayers 4 ruler

I'm refactoring the whole code of the app with modules and I'm having some problem with the Ruler function of OpenLayers 4 now. In the previous code was working OK, but now when I double click on the ...