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
1answer
127 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
92 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
31 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
59 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
23 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
45 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
79 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
165 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
28 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
57 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
31 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
39 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
75 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
1k 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 ...
0
votes
0answers
383 views

Increasing size/height of OpenLayers map/canvas?

I'm trying to let the Map/Canvas height of OpenLayers 100%, but I'm not able to do it. I've already tried putting in several places the "height: 100%;" and used the "map.updateSize()" function, but ...
0
votes
0answers
50 views

View GeoJSON data after clicking on the OpenLayers map

I'm trying to make a piece of code that when I click on the map to return GeoJSON property data that I clicked on. I tried this way: map.on('click', function(e){ //console.log(evt); //...
2
votes
2answers
213 views

how to fix scale 1:4000 to export map in PDF ol3

This is my code to export map in pdf but i want to fix this map in 1:4000 scale the n export or print it to pdf. var dims = { a0: [1189, 841], a1: [841, 594], a2: [594, 420], a3: [420, 297], ...
0
votes
1answer
100 views

Drawing Sectors / Conic Sections in OpenLayers?

I am having trouble finding working examples in OpenLayers 5.3 where conic sections and/or sectors can be drawn. Does anyone have any working code or can point to the correct classes to use? Here'...
0
votes
0answers
45 views

How to give user input scale to export map in pdf ol3

I am developing a portal in which map is shown & export it to pdf. but i want to give such functionality that user select the scale and then map is fitted to that given scale then export it to ...
0
votes
1answer
61 views

Determining the center of a gradient in OL shape

I am trying to draw a circle on an OL map and have the center of it a particular color, have the color fade out to transparent as it gets closer to the edges of the circle. I have been looking at ...
0
votes
1answer
40 views

Trying to change point style -> RangeError: Maximum call stack size exceeded

I'm trying to change the style of some points of a GeoJSON file loaded in OpenLayers and I getting this error: RangeError: Maximum call stack size exceeded I want to modify the point style related ...
1
vote
2answers
57 views

Openlayers squeezes placemarks after changing map projection

I have a map with OSM as a base layers and several layers on top of that. Two layers (red polygons with gray fill and black placemarks) are instances of TileLayer (source TileWMS -> geoserver). Both ...
0
votes
1answer
58 views

get() and getProperties() are not a function, from a VectorLayer (GeoJSON)

I'm trying to get the value "GRID_CODE" from the attribute table of a GeoJSON file and keep getting this two errors: TypeError: myFeature.get is not a function TypeError: myFeature.getProperties is ...
0
votes
0answers
78 views

OpenLayers 4 change position on load and input change

I have map which should show position depends on input, which I control with switch. Long and Lat I am getting from API (depends on my input) which return to me coordinates. How can I show position ...
0
votes
1answer
127 views

Adding Yandex Satellite map in OpeLayers

How can I add Yandex satellite map in OpenLayers? new ol.layer.Tile({ title: "Yandex Uydu", baseLayer: true, visible: true, source: new ol.source.XYZ({ url: 'http://vec0{1-4}.maps.yandex....
0
votes
1answer
76 views

Find index of Linestring element at feature, when hovering - openlayers/GeoJson

I have a Geo-JSON Linestring, this is drawn by 800 elements in OpenLayers 4.6.5. I'am trying to use the map.forEachFeatureAtPixel, and print a pop-up when hovering for individual elements on the ...
1
vote
1answer
92 views

OpenLayers Load KML Layer in the background

I would like to show a polygon in OpenLayers. The polygon was defined in 3 KML files with difference level of detail, ie: Low Resolution KML (with 100 points) Medium Resolution KML (with 1000 points) ...
1
vote
0answers
36 views

How to disable imageSmoothingEnabled for geoImageLayer?

Considering the code below (which uses openlayers and Viglino's ol-ext), how do I disable imageSmoothingEnabled for the geoImageLayer? I am trying to achieve the same thing as in this question, but ...
0
votes
1answer
57 views

Layer won't show on OL map

I am new to OL and I'm trying what I thought was a pretty simple thing. I would like to see a second layer that shows lat/lon points. Is the code below the correct way to achieve it, or am I missing ...
-3
votes
2answers
92 views

Running OpenLayers from localhost? [closed]

How to run OpenLayers using localhost? I already installed Apache Tomcat and GeoServer war. In what folder should I place all the OpenLayers file?
0
votes
0answers
36 views

Adding feature to highlight layer forces redraw of original layer

I have two VectorLayers setup, one for my actual features and another one for highlights (I'm rendering ~10000 features so I have a separate layer for highlight as recommended by ahocevar). However, ...
0
votes
0answers
40 views

I can not Add GML Layer in OpenLayers 4

I use openlayers 4 and gml layer is file type, but when i add gml layer to map using ol4, i have a ploblem. Gml is polygon but it appear as some point in map. Can not anybody help me? Below is my ...
1
vote
1answer
64 views

Open Layers 5 - Dynamically toggle zoom buttons [closed]

I would like to disable the zoom in button if a user tries to zoom in past a certain level. I would like to disable the zoom out button if a user tries to zoom out past a certain level. I see that ...
1
vote
1answer
47 views

How to fix layer styling in OpenLayers 5?

I'm trying to draw a new layer every time user clicks on the map. My styling function can be seen below; function CatchmentLayerStyleFunction(feature) { var colors = ['rgba(255,0,0,0.5)', 'rgba(...
0
votes
1answer
50 views

How do I add a georeferenced JPEG with a JGW Worldfile to OpenLayers v5.3.0?

I have a JPEG file with an associated .JGW worldfile containing the following data: 0.0144218 0 0 -0.0144218 -65758.8265181 -130841.5565499 My Jpeg is 21177*14242 pixels resolution. I'm currently ...
1
vote
1answer
105 views

CORS issue loading an external local GeoJSON into OpenLlayers 5

I have a local folder on my network with my HTML file and two subfolders, one with the downloaded folder from OpenLayers (renamed ol) and the other with my GeoJSON file (data). When I try to load the ...
0
votes
0answers
48 views

WFS Transaction Post Method 403 OpenLayers 3 + GeoServer

I am having difficulty understanding the topic when it comes to XML generated from GeoServer and how can we interact with it. I want to to implement WFS transaction service and updating my attributes ...
1
vote
2answers
159 views

How to pass tile size of to 512 using OpenLayer 3 and GeoServer 2.14

I am trying to change the default tile size of 256 to 512 using OpenLayers 3. Code is working fine for normal WMS request, but giving error (tiles not loading) for WMS-C request. My sample code is: ...
1
vote
0answers
30 views

Cycles in LineString in PostGIS table?

I have a LineString table in PostGIS, which represents wiring in streets. Where the geometry column represents the wiring lines; firstpoint is the first geometry point (cable segment); lastpoint the ...
1
vote
1answer
129 views

OpenLayers: How do I remove a layer based on a value?

In React, I'm using a pagination that returns a certain amount of results on each page. Using the address of these results, I convert them to longitude and latitude using a geo-coder package and set ...
1
vote
1answer
42 views

Publishing a big raster layer via GeoServer

I have a big raster layer (7GB) and I want to publish it so it can be accessible from my Geoportal using OpenLayers 4. I couldn't find a clear procedure to do that, I started by tiling the image but I ...
0
votes
1answer
199 views

How do I change the style of all markers in OpenLayers3?

This is probably a newbie question, but am at my wits end. I have a map that has several markers (see attached code). What I am trying to do is alter ALL the markers depending on a map event (e.g., ...
1
vote
1answer
94 views

Merge Advanced View Positioning and View Animation functions

I'm trying to merge two functions that are displayed as OL's samples, the Advanced View Positioning and the View Animation. I can successfully change the view with the animation method, but I can't ...
2
votes
1answer
69 views

In OpenLayers how can I enable users to cancel the completion of a polygon, and carry on drawing it?

I am using the OpenLayers v4.6.5 Draw interaction. drawInteraction = new ol.interaction.Draw({...}); map.addInteraction(drawInteraction); I want users to be able to add properties to the features ...
2
votes
1answer
132 views

Print XYZ Layer Using Geoserver, Mapfish, GeoExt

How can I get base layers added to an OpenLayers map using the OpenLayers.Layer.XYZ method to print in MapFish/GeoServer? The Geoserver/Mapfish print service is not printing any of my XYZ base layers ...
0
votes
0answers
31 views

Adding 3D GML file in OpenLayers

I have a GML file which has Z values associated. Is there a sample to show this GML file with 3D in OpenLayers?
1
vote
1answer
151 views

Detecting polygon self-intersection

Currently using OpenLayers to allow users to zoom/pan to an area and drop a modifiable 1x1KM Square Polygon. As this polygon is modifiable, for the purposes of validation I need to ensure the final "...
1
vote
1answer
29 views

OpenLayers freehanddraw forEachFeatureInExtent returns features not in shape

I am not a newbie. I am trying to get the features(icons) found inside a closed freehand line. The approach I am taking is to take the extent returned from the drawing and use it to get the features(...
0
votes
0answers
49 views

OpenLayers forEachLayerAtPixel and MapServer .MAP file COLOR

I'm trying to use map.forEachLayerAtPixel in OpenLayers to see what layers are clicked, but I have a layer in the background that is a grid served by Mapserver with a grid.map file that is just a ...
0
votes
1answer
112 views

getFeatureInfo in OpenLayers using text/javascript returns unselectable popup

I am trying to make a getFeatureInfo request (OL4) and display a popup with data, that come from a geoserver layer. Initially I did this: map.on('click', function (evt) { var ...