Questions tagged [openlayers]

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

0
votes
1answer
61 views

OpenLayers refresh vector source with bbox strategy after map moved

I have a vector layer, in GeoJSON with a Vector source on which I applied the BBOX strategy. I have unique IDs for each feature in the layer and having a look at the network tab in the browser the ...
0
votes
0answers
9 views

Filtering by area/size on via WFS on GeoServer with OpenLayers [duplicate]

I'm trying to add a filter for area/size of polygons into our OpenLayers v4 implementation which gets polygons from our GeoServer via WFS v2, I've seen the example on GeoServer with area and ...
0
votes
1answer
111 views

OpenLayers 5 ZoomToExtent API

I have a button with class search_ and when clicked i want to change the map view to a specific extent. I am using ZoomToExtend API. Here is what i try, without anything working: var roadlayer = ...
3
votes
1answer
98 views

Flip feature Icon

I want any method or help to be able to flip (vertically and/or horizontally) the feature's icon without using the rotation option in the icon style since I am using it already to rotate the icon also....
1
vote
0answers
38 views

Adding marker with specific functions on OpenLayers?

I am new with OpenLayers, my problem seemed easy, but I have troubles with that. I am trying to make some markers when the map loads up, I need 3 of them lets say and also I have some callback from ...
0
votes
0answers
27 views

setStyle() throws assertion error 41. https://openlayers.org/en/latest/doc/errors

I am trying to set the style of open layer by passing in an object but it is throwing error and when object is passed in an array then it works. Why isn't it letting me pass an object? The code below ...
0
votes
1answer
25 views

Get actual error from ol.source.WMTS.optionsFromCapabilities

I am using the method ol.source.WMTS.optionsFromCapabilities to create a WMTS layer and when I am trying to use a projection that does not exist in OpenLayers it throws an error. Please note that ...
1
vote
1answer
82 views

Openlayers 5: view and save coordinates from drawn feature

I've been following the various examples including this OpenLayers: Get Coordinates of drawn features and this https://openlayers.org/en/master/examples/snap.html and have produced the code below (...
1
vote
1answer
31 views

Draw a polygon in OpenLayers with coordinates from a variable?

I have the polygon coordinates defined as a variable. This draws nothing when I use the variable, when the same coordinates are used as such in the polygonFeatureT definition, the polygon is drawn ...
0
votes
0answers
31 views

Deactivating measurement tool in OpenLayers 5?

I have created a web portal in which measurement tool is available where user select measure distance and area. Now my problem is how to activate and deactivate it when user click on button. here is ...
0
votes
1answer
25 views

Using OpenLayers with markers on html?

I am having problem showing a marker on page, I have this code which is implemented on my page, in console it is not showing any errors , the map is shown also with this code, but I cant see marker. ...
1
vote
1answer
32 views

Layer renders twice with EPSG:5514 in WMTS OpenLayers

I am trying to create a WMTS layer in OpenLayers with the following properties: Url: http://geoportal.cuzk.cz/WMTS_ORTOFOTO/WMTService.aspx Matrix set: jtsk:epsg:5514 Projection: EPSG:5514 I am ...
0
votes
1answer
42 views

How to get individual features from a GeoJson-Multipoint feature using map.on('click'…) in openlayers 4.6.5

I'm trying to get the features of each MultiPoint-point when i click on a point in my openlayers map (4.6.5). The points shows on the map. I want to add a pop-up on each feature when i click on the ...
0
votes
1answer
29 views

Find Layer name by click on features in OpenLayers5

I have two vector layers showed but want to differentiate features show for layer1 and layer2. I have this code: var feature = map.forEachFeatureAtPixel(evt.pixel, function(feature, layer) { ...
0
votes
0answers
24 views

Multiple point add in OpenLayers maps with ajax request

I want to display multiple points in the database on the OpenLayers map. Points are in the form of gps coordinates. Here is the code that we have done so far: <?php $con = mysqli_connect("...
1
vote
0answers
59 views

Calculating pixels coordinates from lat/lon

I'm trying to develop a WPS that would print maps to images and PDFs. I don't want to use Mapfish because of its limitations, and because of some customization I need to add to the printed maps. My ...
2
votes
0answers
76 views

Rendering huge vector data whose geometry is fixed but attributes are changing every 2 minutes?

I want to create an application displaying road network with traffic details. I am using OpenLayers 3 and GeoServer 2.14 for this purpose. My data (stored in PostgreSQL+ PostGIS) has around half a ...
1
vote
2answers
122 views

OpenLayers: Keep text style label in visible polygon area

I have a feature with a polygon and a text attribute. The text attribute is displayed via a text-style above the polygons center. Nothing special and so far so good. The current behavior: I can move ...
0
votes
0answers
31 views

highlight all polygons within another polygon ol5

I have 2 WFS layer using openlayer 5 API. I am filtering 1st layer by ID so that one polygon is highlighted now I want to highlight all polygons which comes under the filtered polygon from 1st layer. ...
0
votes
0answers
47 views

OpenLayers: feature.setStyle overwrites style of Select interaction

let's say I have a vector layer created from 2 features. The vector layer has style set to green color. There is a select interaction with a style set to red color (in other words, I want to click on ...
0
votes
0answers
16 views

WMS OpenLayers filter for date

I need to filter the WMS layer included in my map for a date field. Basically I only want to show what has happened after a certain date: I tried the following, but no luck createMap = () => { ...
0
votes
0answers
29 views

OpenLayers Plugin Issue

I get this error when pulling a map from the OpenLayers Plugin. See Below. An error has occurred while executing Python code: AttributeError: 'OpenlayersLayer' object has no attribute '...
1
vote
0answers
49 views

Labeling when using qgis2web

I'm having trouble getting labels to appear in a web map, both Leaflet and OpenLayers, using qgis2web. I can't get either label buffers or backgrounds to show up and even a Bold style only works in ...
0
votes
1answer
48 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
36 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
95 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
56 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
54 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
30 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
19 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
49 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
31 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
1answer
56 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
1answer
42 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
74 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
99 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
33 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. ...
1
vote
0answers
27 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
54 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
122 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
85 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
139 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
49 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
22 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
271 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
36 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
26 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
33 views

OpenLayers5: GeoJSON: featureProjection vs dataProjection

What's the difference between featureProjection and dataProjection in OpenLayers 5, GeoJSON class?
0
votes
1answer
27 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
43 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: ...