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

0
votes
0answers
5 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 '...
2
votes
1answer
2k views

How to get wms layer's extent OpenLayers3?

Here is a part of my code: var wms = new ol.layer.Tile({ source: new ol.source.TileWMS({ url: 'localhost:8080/geoserver/BEIS_WS/wms', params: { ...
1
vote
0answers
15 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 ...
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
498 views

Using OpenLayers for projection of static image on worldmap?

Using the latest OpenLayers, I'm trying to overlay a simple static image over the regular OSM streetmap. Although there are examples how to overlay an simple static image which is in the same ...
27
votes
5answers
12k views

Maximum number of point features in an OpenLayers vector layer

In your experience, how many point features can be added to an OpenLayers vector layer (new OpenLayers.Layer.Vector("Point Layer")) before it goes unusably slow? My use case is to display points from ...
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
1answer
832 views

How can I change layers visibility while I zoom in GeoServer?

I want to change layers visibility while I zoom , here are my screenshots. where is my error ?
3
votes
1answer
758 views

Loading multiple feature types as one layer in OpenLayers?

I have a kml file which contains some polygon and some point features in the same file. I am trying to load and view this layer on my basemap in OpenLayers. The problem is that the polygon features ...
0
votes
1answer
155 views

Openlayers 3 polygon-feature “collision”?

I am currently building a webapp using openlayers 3. I build in "GPS-tracking" as a features and I got some questions with that. So, is it possible to run a function if a GPS-Position as a point-...
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....
0
votes
1answer
170 views

Reading geojson properties in openlayers 4?

My code is very simple. This is my vector-source and this is how I render my geojson : var vectorSource = new ol.source.Vector({ format: new ol.format.GeoJSON(), url: 'some_geojson_is_here' }); ...
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
56 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
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 ...
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....
2
votes
2answers
862 views

How to find feature in OpenLayers exsisting layer

I have a vector layer in my OpenLayers applicaiton. var layer = new ol.layer.Vector({ source: new ol.source.Vector({ url: "my geojson url" }) }) my GeoJSON data fills the ...
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
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>...
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
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
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 ...
1
vote
1answer
200 views

Order of coordinates for extent property in layer Tile?

I was just going through the documentation for OpenLayers 3.11 and came across Tile(). Now it accepts a lot of properties: opacity, preload , map, etc.), but the one I am interested in is extent. ...
0
votes
1answer
132 views

OL3 gwc background layer does not align to gridset, works in OL2

I'm using GeoServer 2.10.1 and its built-in GeoWebCache and am trying to use a cached background layer in a custom gridset with a local epsg to work in a simple Ol3 app: proj4.defs("EPSG:3010","+proj=...
0
votes
1answer
1k views

Openlayers 4 and View Extent

I have been working on openlayers 4 and specifically my question is regarding limiting the extent the user sees, let's say 2 km by 2km is the viewing area, this configuration was done using the ol....
0
votes
1answer
304 views

Openlayers get boundingbox around circle in cluster layer

I have a cluster layer which contains circles. Each circle contains some number of features. I need to get the smallest bounding box for a circle when it's clicked. If I could get the center and ...
1
vote
1answer
104 views

OpenLayers 3: Vector Layer loses styling when map pans or changes zoom

I'm working on switching from OpenLayers 2 to OpenLayers 3 and supplementing my reading of The Book of OpenLayers 3 by trying some things out on my own. There's a project that I'm building here that ...
0
votes
1answer
464 views

How to get layer name from getFeaturesAtPixel in OL4

I'm trying to build a popup that only shows feature info from certain layers. How do I get layer name? I've tried this: const features = this.map.getFeaturesAtPixel(evt.pixel, { layerFilter: ((...
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?
1
vote
1answer
72 views

Can't add VectorTile in Openlayers 4

I'm trying to add a vector tile layer in my app using Openlayers 4 , but I'm getting the error as follows , ol.js:753 Uncaught TypeError: a.replace is not a function Here is my code to add the vector ...
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
1answer
234 views

Openlayers: Update scale from resolution in cached features?

I have a large number of cached vector features which I am caching for speed. However, as they need to change size depending on view resolution, I have to do various updates on them with each ...
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
0answers
23 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 ...
1
vote
3answers
3k views

How to get the distance between a point and a line in openlayers 3?

I've been working lately with openlayers 3 and trying to get a fully offline Mapping app, I am trying to get the smallest distance between a point and a line. I looked for a solution in the api and ...
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
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 ...
0
votes
2answers
217 views

How to specify custom CSS to an OpenLayers Zoom Control in Angular 6?

I am attempting to modify the Zoom buttons on OpenLayers 5.3 in an Angular 6 component. And I'm using this OL3 question as a starting point: Creating new buttons and removing default ones - Openlayers-...
1
vote
1answer
53 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
1answer
87 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
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
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
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 ...
1
vote
0answers
98 views

Popover displacing from position when zooming OpenLayers 3

I have some markers in position with OpenLayers 3, and now I am trying to get the Popover onto them. The problem is that when zooming in/out, Popovers don't remain with the marker. I want to make it ...
3
votes
1answer
3k views

Marker appears in different position when zooming

I am using OpenLayers 4 and following the example http://openlayers.org/en/latest/examples/icon.html didn't work when I implemented. I need to place several maps from latitude and longitude ...
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,...