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
The results are in! See what nearly 90,000 developers picked as their most loved, dreaded, and desired coding languages and more in the 2019 Developer Survey.

Questions tagged [openlayers]

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

0
votes
1answer
22 views

is it possible to show all labels of WMS layer at any extent without SLD ol5?

I am showing WMS layer that shows label on it by defining SLD in GeoServer. The problem is that is is not showing all labels at particular extent. But when I zoom in, all labels are displayed. My ...
1
vote
0answers
28 views

Very slow loading while fetching WMS layer as image/svg ol5

I want to fetch WMS layer as SVG image but it is loading very slow. How to resolve this issue? Here is my code var grid_10hact = new ol.layer.Image({ title: '10 Hactare Grid', source: new ol....
1
vote
1answer
44 views

Difference between ol.proj.getPointResolution() and ol.sphere.getDistance()

Is there anyone who can explain the difference between ol.proj.getPointResolution() and ol.sphere.getDistance()? I have tested it, and ol.sphere.getDistance() is a little bit shorter than ol.proj....
1
vote
1answer
47 views

OpenLayers - LayerSwitcher MattWalker not working with fetch()

I have a problem with Matt Walker's LayerSwitcher on my map construct. I use fetch () to get a WFS. Unfortunately, the LayerSwitcher does not respond to the vector and nothing is displayed in the ...
1
vote
1answer
38 views

Calculate distance from GPX in OpenLayers

I have a little OL script to display GPX Routes in a OSM map. That works so far, even with a little gimmick. What I miss is a continuous distance. So from trkpt 0 to trkpt 1 + (trkpt 1 to trkpt 2) + (...
0
votes
1answer
28 views

Blank screen when using tiled wmts in Geoserver and Openlayers

I am currently following the book GeoServer beginners guide (ISBN: 978-1-78829-737-0). I am on chapter 8 and have been using the following code sample from the book: <!DOCTYPE html> <html>...
0
votes
1answer
12 views

Change specific tile image source in OpenLayers 5

I defined a XYZ source and added to map var source = new ol.source.XYZ({ url: 'http://blabla.com/{x}/{y}/{z}.png', crossOrigin: 'anonymous' }) During runtime I can access specific tile by map....
1
vote
3answers
24 views

Update base layer on toggle button change in OpenLayers

I have an html toggle button and try to toggle update between two layers (baselayer and earthlayer) when it's changed. I am assigning a variable and change the value to the corresponding layer. ...
0
votes
0answers
19 views

Getting OpenLayers pixel value of DEM layer?

I am working in OpenLayers and need to get pixel value of DEM layer to get the altitude of the place. Can you guide me?
0
votes
0answers
26 views

Setting template or drawing layout to print map ol5

I have created a portal which export map and then print. I just wanted to add template or draw layout in canvas for that pdf as shown in the picture below. Here is my code: //print map var dims = { ...
0
votes
0answers
22 views

OpenLayers 4.6.5 - jQuery : map disappears after hide() show() event

This is a little example of what I'm trying to do : https://codepen.io/remifroger/pen/ZZWgbM I would like to build a tabs design, with one map in each tab. I use jQuery to deal with it but I have a ...
2
votes
1answer
37 views

Snap to crossing between lines in OpenLayers

Is it possible to let the snap interaction snap to the crossing of two different lines (or polygons) in OpenLayers? It can snap to vertices and lines between vertices, but I can't see a way to snap ...
2
votes
1answer
39 views

Is it possible to have an animated SVG as a vector layer feature?

Is it possible to have an animated svg as a vector layer feature? I'm using D3 to make the animation. Here's my animated svg: https://jsfiddle.net/eflowbeach/opfkh0n9/1/ I thought I was onto ...
0
votes
2answers
32 views

Loading WMS in OpenLayers

I am trying to load this https://mrdata.usgs.gov/services/ardf?request=GetCapabilities&service=WMS&version=1.3.0& WMS in OpenLayers3. However, it has two layers (layer within layer e.g. ...
0
votes
0answers
32 views

Search the PostGIS database to display the result in a table then highlight it on the OpenLayers map by id [on hold]

We did a search in the database according to certain search criteria, we displayed the results in a table by ajax request directly from the database. My problem is now I can not highlight on the map ...
1
vote
0answers
23 views

Organizing large numbers of vector layers with GeoServer

I have a large number (100,000+) of vehicle GPS paths in a PostGIS database. I need access to all of them on my web page, however, I don't usually need to view more than a handful on the map at any ...
2
votes
0answers
43 views

Using OpenLayers with alternative map source to integrate Google Street View?

I am researching any possibilities of Using an alternative map source other than Google that I can integrate Google Street View. Due to the drastic rate changes for Google Maps API I would like to ...
1
vote
1answer
52 views

How to draw a line with OpenLayers by clicking two points?

I've got website with OpenLayers tile layer. I am trying to draw vector line on the map (only one segment between 2 points) on mouse click and to get coordinates of these two points. I read a lot on ...
0
votes
0answers
58 views

GeoServer returns 401 unauthorized when requesting data via openlayers

When using the line crossOrigin: 'anonymous',, it returns 401 unauthorized response. When commenting out that line it works, but I have to be log in to the GeoServer. Update: I have changed the ...
0
votes
1answer
41 views

How can I add satellite map in OpenLayers 5?

I have taken a look at this example but it requires a license from Bing maps. Is there another option to show satellite view as base layer? var baseLayer = new ol.layer.Tile({ source: new ol.source....
0
votes
0answers
25 views

On click GeoServer WMS layer features in ArcGIS JS API

I am consuming a GeoServer WMS layer in ArcGIS JavaScript API. I am successfully able to display layer. Now I am not able to get layer info on map click or layer click. Below is code using to add ...
0
votes
1answer
20 views

WMTS in OpenLayers unable to zoom into detail

Based on the OpenLayers example at https://openlayers.org/en/latest/examples/wmts-layer-from-capabilities.html?q=wmts I'm trying to load a WMTS in my own example here https://codepen.io/vishnu4/...
0
votes
1answer
86 views

Openlayers 5: Click event on specific layer?

I have a couple of layers and i want to add click event on a specific layer of the map. E.g. If clicking on parcels, do different ajax request than clicking on buildings. How can i do it? var ...
0
votes
0answers
24 views

Keep the popover in the same position when zooming in the map with Bootstrap 4 and OpenLayers 5

I tried the popover example from the OpenLayers web site: https://openlayers.org/en/latest/examples/overlay.html It works very well but when I change the version of Bootstrap to version 4 and jQuery ...
0
votes
0answers
23 views

Outputing degrees on map click in OpenLayers 5?

I am outputting the coordinates. However I am trying to output the degrees instead. How is it possible? My PostgreSQL query looks like that: SELECT * FROM view_parcels p WHERE st_contains(p.geom,...
0
votes
1answer
20 views

OpenLayers5: GeoJSON: featureProjection vs dataProjection

What's the difference between featureProjection and dataProjection in OpenLayers 5, GeoJSON class?
0
votes
1answer
23 views

Deselecting previous selection in OpenLayers?

Previously we did when you click on a geometry on the map to color in another color and zoom on geometry. But now you should deselect the previous selection in the original color in which the map was ...
1
vote
0answers
25 views

Getting attribute information from layer in OpenLayers [closed]

I just want to add a layer that represents a city with its city districts. When the user clicks on a district, the site fires an alert presenting the population number. It looks like that: ...
0
votes
1answer
94 views

Showing layers features data on click in OpenLayers5?

I am trying to display layer data on map click but I can't figure out how to do it. There is not an example of this important feature. I believe it's the getfeatureinfo event. Here is the messy API ...
0
votes
1answer
49 views

Searches by area names in OpenLayers with request of AJAX in the PostGIS database

We built a GeoJSON: {"type":"FeatureCollection","features":[{"type":"Feature","id":0,"geometry":{"type":"Polygon","coordinates":[[[669023.843,415221.025],[669031.588,415222.415],[669059.365,415154....
0
votes
2answers
55 views

OpenLayers adding/removing layer when checkbox is changed

I am trying to add and remove layers2 layer when checkbox is changed. How can I do it with jquery? Following my way i get: Uncaught ReferenceError: layers is not defined var wmsLayer2 = new ...
0
votes
0answers
39 views

Convert WMS Layers into Image is not Working but it's working for WFS

I'm using this method to convert the Map containing WMS layer to image later use that image in PDF. Everything is working fine for WFS layers but not with WMS layers. function CaptureImage() { ...
2
votes
1answer
49 views

Understanding OpenLayers code?

I'm trying to teach myself OpenLayers and took an introductory course in which we received the whole code. For my first own project I want to do something similar and recycle some of the code. But ...
0
votes
0answers
24 views

Create one function for paused animation maker in OpenLayers

function pauseAnimation() { animating = false; //===== var index = Math.round($("[id='rightfrm:tbv1:txt1']").val() * elapsedTime / 1000); (geoMarker.getGeometry()).setCoordinates(...
4
votes
1answer
78 views

Styling rendered mbtiles in offline web-map service

I am building a digital cartography tool that needs to run completely offline. As a basis, I downloaded a .mbtiles-file corresponding to the area I want to survey and I am running the excellent ...
0
votes
1answer
53 views

Why text labeling is blur when export to pdf ol5

Here is my code that displays wms image on map. filter="VILL_NAME" + "=" + "'" +cad+ "'"+ " AND TEH_NAME" + "=" +"'" +tahsil+ "'"+ " AND DIST_NAME" + "=" +"'" +dist+ "'"; cadLayer =new ol....
0
votes
1answer
54 views

Openlayers error: Uncaught TypeError: t.getLayerStatesArray is not a function

I am getting the following error in the yellow background below. Can anyone explain why i get this? I am not using any bundler i include the ol.js javascript file in the footer Group.js:209 ...
1
vote
1answer
57 views

How to add legends in map canvas when exported to PDF ol5

Here is my code to export map in PDF and map is successfully exported to PDF Now i want to add legends in map canvas but i do not know how to do that. var exportElement = document.getElementById(...
0
votes
0answers
27 views

Zoom to current features in SQL layer in OpenLayers 4.6?

I've created a SQL layer, I'm passing the values for that query from client, I want my map to be able to zoom to whatever the layer that comes after query. I tried GetCapabilities, but it zooms to the ...
0
votes
1answer
36 views

Clicking polygon in OpenLayers map and zooming , centering polygon in map?

I click on the map on a polygon and I'd like to zoom the map and center it around the polygon. We have done so until now: map.on ('click', function (e) {      console.log (s);     // coordinate = ...
0
votes
1answer
14 views

Clicking polygon in OpenLayers map to change color and zoom polygon centre?

My problem is when I click on a polygon element on the map I would like to color another color and zoom by centering that object automatically. map.on ('click', function (e) {       console.log (s);  ...
1
vote
0answers
37 views

Calling external plugins downloaded via Plugins through a separate out of QGIS Python Script

I was wondering if I could produce webpages daily by automatically creating a standalone python script, outside of QGIS. My webpage should ideally contain various layers and an interpolation on top ...
1
vote
1answer
40 views

OpenLayers 5 and GeoJSON with two geometry attributes per feature

I have a GeoJSON file in which each feature has two geometry attributes, one is the default geometry property defined by the GeoJSON standar, and the other one is a property under the standarized ...
0
votes
1answer
62 views

openLayers TileWMS example doesn't work [closed]

I am currently following a tutorial book that is a bit outdated, therefore I have looked at the openlayers website: https://openlayers.org/en/latest/examples/wms-tiled.html to find how to make a ...
0
votes
0answers
25 views

How to give radio button for one layer group and checkbox for other layer group in Geoext?

For Base layer group I want to display radio button and for nonbaselayergroup the checkbox should be displayed. Currently for both we are getting checkbox basicMapGroup = new ol.layer.Group({ name: '...
1
vote
0answers
32 views

Popup data does not change from one icon to another without closing the popup first

I am working on an application that will display markers on an OpenStreetMap. I can get the markers to display correctly on the map via my function, and I have assigned each marker details specific ...
0
votes
0answers
23 views

ECW errors on ubuntugis

i have successfully installed the ECW support on ubuntu qgis. the main challenge that i have is that whenever i try and load an ecw file, the qgis main window crashes. On the other had i am able to ...
0
votes
1answer
30 views

Openlayers: Display feature labels

I try to add labels of a vector I added in openlayers with a stylefunction. The function works for stroke, but no text is displayed and I can't find a solution for it. My code is the following: var ...
1
vote
2answers
47 views

Put a label on OpenLayers from GeoJSON

I have a geojson and I want every property to put a label in its middle with a number .. Here's the function I'm putting on the geojson map: function search(){ var layer = $('#layer').val(); ...
0
votes
1answer
225 views

OpenLayers 5 add multiple markers

I'm using OpenLayers 5 to show a map and add markers to it. I can see the map without any problems but only the last marker is shown. I saw an answer about using .clone() method on the marker that's ...