Questions tagged [openlayers]

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

Filter by
Sorted by
Tagged with
1
vote
1answer
37 views

Restricting GeoServer to OpenLayers on localhost?

I'm publishing WMS-Layer with GeoServer that should be accessible only by an OpenLayers client running on the same machine. The OpenLayers map is not public and I want to restrict also the WMS ...
0
votes
1answer
67 views

GeoServer WMS-layer in OpenLayers only shows labels

I'm new to GeoServer and encountered the following problem that i don't know how to solve. I have PostGIS-Data in the luxemburghish SRID EPSG:2169 that I transform to EPSG:4326 (seems to be easier to ...
2
votes
1answer
33 views

How to get clicked coordinates on the line in OpenLayers?

In OpenLayers, we get the line feature on the clicked point by such kind of codes: map.on('singleclick', function(e) { var hit = false; map.forEachFeatureAtPixel(e.pixel, ...
0
votes
1answer
52 views

Geoserver and WMS endpoints

I'm trying to access a WMS endpoint through Openlayers to display the data in a slippy map. Here's my code: var basemap = new ol.source.TileWMS( " Layer Name 1", "http://localhost:8080/geoserver/...
1
vote
1answer
85 views

How to get only Intersected polygon in Open Layers 3

I am trying to draw a line on polygon which I want to split, Example: I want to split 616 polygon as show in image with below code when I tied to get intersected polygon I am getting 616,617,615 ...
0
votes
0answers
30 views

OpenLayers: find out the units of height value

Is it possible in OpenLayers to find out (ideally from ol/proj/Projection or from ol/source/Source), what is the Unit of Measurement for height (z-coordinate)? Or is it possible to assure somehow, ...
1
vote
2answers
197 views

Using rendercomplete for vector layer in OpenLayers 5

I am interested to add a preloader on the web page, cause i'm loading on the map a 15mb vector, so when all layers are loaded on the map i will hide the preloader. I have found the rendercomplete ...
1
vote
1answer
19 views

OpenLayers using exceed len on vector styles

I have a text inside a style which fits inside a vector polygon. On small polygons the text disappears (map is zoomed in max) so I am trying to set exceed len to true based on this example. How can ...
1
vote
1answer
166 views

Openlayers 5: zoom view to features in a layer

I'm adding a number of features (linestrings and points) to a layer and I want to zoom/pan the map view to the extent of those features. I thought I'd have to do the following: var map = new ol.Map({...
0
votes
1answer
436 views

canvas.toBlob(function(blob)) is giving SecurityError: The operation is insecure

I'm trying to get the image of Map from OpenLayers 4.6.5 and the following error is appearing each and every time. I'm using cdn link of OpenLayers 4.6.5 for the base Map in JavaScript with Apache ...
0
votes
1answer
41 views

Adding mouse move to my map using OpenLayers

I'm a new JavaScript coder. I'm adding a mouse move to my map using OpenLayers but it's not working to display coordinate in my mouse. 1 - The first step I wrote this code in my js file: map.on('...
1
vote
1answer
32 views

How to avoid start/end points of line modification with ol.interaction.Modify

To modify line geometry on OpenLayers(3-5), we use ol.interaction.Modify. What I want to do is, enable modify any points on line, except start / end points. But just using ol.interaction.Modify ...
0
votes
2answers
61 views

ArcGIS REST layer doesn't show up in OpenLayers

I try to show a WMS layer with OpenLayers 4.6.5 but the tiles don't show up. I use the following code to load the WMS layer as ArcGIS REST service: new ol.layer.Tile({ source: new ol.source....
0
votes
0answers
61 views

Map component .getWidth() is not a function (GeoExt3, MapFish, OpenLayers 4)

I'm trying to work through the tutorial here*. But I'm discovering something unexpected in terms of my map component. Background info on the app/installation: I installed GeoExt3 by cloning this ...
1
vote
0answers
80 views

Not able to display KML file - OpenLayers

I tried to load my KML file from one of the OpenLayers examples import Map from 'ol/Map.js'; import View from 'ol/View.js'; import KML from 'ol/format/KML.js'; import {Tile as TileLayer, Vector as ...
1
vote
0answers
28 views

Transformation issue with SVG to GeoJSON conversion

I have a vector image in SVG format. (without georeferences) I am trying to display it using OpenLayers to display properties of different polygons in it. I tried converting it to GeoJSON but the ...
0
votes
1answer
110 views

Create layer based on input parameters and zoom in OpenLayers 5

I have a vector layer which i statically load all the features from the JSON file. What I want to do is to create layers dynamically based on the user input. The user will choose district code, for ...
0
votes
1answer
43 views

OpenLayers, problem with WFS service and “outputFormat”

I have a service and I tried to paint his layer on my map: http://www.ign.es/wfs-inspire/unidades-administrativas?REQUEST=GetFeature&SERVICE=WFS&VERSION=2.0.0&COUNT=1&srsName=EPSG:...
0
votes
0answers
42 views

SVG to GeoJSON conversion - incorrect render [duplicate]

I have a vector image in SVG format.(without georeferences) I am trying to display it using OpenLayers to display properties of different polygons in it. I tried converting it to GeoJSON but the ...
1
vote
0answers
59 views

Using olms to style self hosted mbtiles from openmaptiles not working

I've downloaded a OpenStreetMap vector tiles (.mbtiles) file from openmaptiles.com and successfully hosted them using node.js with the mbtiles and express node modules. I want to use a style gotten ...
2
votes
2answers
107 views

Setting Labels on Vector features in OpenLayers 5

I am following this very big example to set labels on the style of the vector but it's confusing. The labels should be the Plot numbers, of each feature, which come from the JSON file. Also i have ...
0
votes
0answers
52 views

Getting attribute info from OpenLayers (QGIS2Web)

The below files are generated from QGIS2Web tool and altered by me, I generated the OpenLayers code using QGIS2Web. The problem is not showing the pop-up(attribute information) for multiple Layer ...
1
vote
1answer
377 views

OpenLayers 5: add Interaction and style selected feature

based on this example addInteraction adds opacity, so I am setting a new style for each selected feature, however the clicked features remain red. I only want to style with the red border only one ...
1
vote
1answer
50 views

Store geometry change on modify interaction OpenLayers

I am using OpenLayers modify interaction with events modifystart and modifyend. I am trying to remember state of feature before it is modified. I do it this way: var modificirane_cestice=new Object()...
1
vote
1answer
66 views

Styling OpenLayers 5 Vector dynamically

I have a checkbox button, and I am trying to change the variable getStyle dynamically, when jQuery change event is triggered. Though style property doesn't get updated when the event is triggered. ...
0
votes
1answer
47 views

Map exported to PDF background color is black ol5

When I am exporting map to PDF, it is all looking black in backgroud. Here is my code map.once('rendercomplete', function(event) { $('.filter').css('display','none'); var canvas = event....
0
votes
0answers
29 views

Cursor not centered on feature - OpenLayers

Can anyone tell me why the cursor is not centered on the feature? This can be seen in the Overlay event of the map and even in the onClick event. We can only click on the element in a certain position,...
0
votes
1answer
138 views

ol.inherits in OpenLayers 6

I'm testing OpenLayers 6 beta. ol.inherits looks missing in OpenLayers 6. ol.inherits(ol.source.NowMap, ol.source.OSM); This causes error Uncaught TypeError: ol.inherits is not a function What ...
0
votes
1answer
88 views

Modify polygon in OpenLayers

Here is the next function to select and modify the selected polygons. I have an error in var "vectorLayer = new ol.layer.Vector": missing: after property id. that someone are correcting my code and ...
3
votes
1answer
96 views

Displaying GeoServer vector tile using OpenLayers?

I'm using OpenLayers 5.3 and GeoServer to create a web map. Previously, I was using Leaflet and was able to display my layer as a vector tile. Now, I'm having issues getting the vector tile to display ...
0
votes
0answers
24 views

OpenLayers drag event slow to respond (hard to move)

We have an application that loads data from the postgis and draws on the map in layers of vectors. When many elements are loaded, does the map get heavy to use the drag event, slow to respond to user ...
2
votes
1answer
76 views

get only property name and value from getGetFeatureInfoUrl WMS layer ol5

Stuck in a problem to get only property name and value of WMS layer. here is my code var point_wms = new ol.layer.Image({ title: 'Gound Control Point', source: new ol.source.ImageWMS({ ...
1
vote
0answers
87 views

Show/Hide labels of Vector Tile layers on button click

I have displayed vector tiles layers with "application/vnd.mapbox-vector-tile" format in Open Layers 3.While creating vector tile I have applied only image style. I want to display labels for existing ...
1
vote
0answers
163 views

Getting distance between route and points around that route?

I have a route between 2 points by means of OSM routing service. I want to get the distance between route and points around. How can I achieve this? I created this route by the following example ...
0
votes
1answer
49 views

Add loading image until filtered layer is shown ol5

I am developing a portal in which I have created a rectangle buffer and the polygon within buffer is selected. Here is my code to filter layer var polyStyle = new ol.style.Style({ stroke: new ...
1
vote
1answer
156 views

Create Polyline from Coordinates Array in OL OpenLayers 5.3.2

I'm using OpenLayers 5.3.2, and would like to create my own marker animation using almost exactly the example at https://openlayers.org/en/latest/examples/feature-move-animation.html?q=marker All I'd ...
1
vote
2answers
92 views

OpenLayers 5.3 - Managing lots of layers and “sublayers” depending on their attributes values

I'm currently implementing a web map application (OpenLayers 5.3, Tomcat 8/GeoServer 2.14.0, Apache) There is a rising number of vector layers coming from different external WFS services. Using WMS ...
0
votes
1answer
57 views

Create rectangle with center point , height and width ol5 API [duplicate]

I am trying to develop a web portal using ol5 API where user click on map and then it takes map click event coordinates as centroid of rectangle and create a rectangle of particular height and width. ...
0
votes
0answers
51 views

Creating rectangle on centroid point by map click event ol5

I am trying to develop a web portal using ol5 API where user click on map and then it takes map click event coordinates as centroid of rectangle and create a rectangle of particular height and width. ...
0
votes
1answer
90 views

Which is more performant GeoJSON or WMS/WFS using OpenLayers? [closed]

I'm developing a web application using PostGIS, Laravel, Vue.js and Openlayers, for the moment I generate the GeoJSON from my database using the following code : public function plosWithGeom() { ...
0
votes
0answers
56 views

Why does GeoServer WMS not work in OpenLayers? Problem viewing GeoServer layers

Adding two layers using OpenLayers, one map layer from OSM, second layer adding from GeoServer localhost. But when I load single OSM layer it's showing by default map. It's okay, but when adding ...
-2
votes
1answer
67 views

WFS display problem using GeoServer and OpenLayers

I know a lot of issues have already been posted about this tricky situation, but I can't figure out where is the problem in my script and most of the discussions about OpenLayers are outdated. I'm ...
0
votes
0answers
33 views

Rule based styling in OpenLayers 4

I uploaded some shapefiles to GeoServer and I added them to OpenLayers map using WFS protocol. Now I want to style them by some properties. How can I do this?
1
vote
0answers
83 views

OpenLayers Icon with ngClick

I am working off the OpenLayers Icon Symbolizer example (https://openlayers.org/en/latest/examples/icon.html) to create an equivalent to a Google Maps marker new google.maps.Marker({...}) With ...
1
vote
0answers
127 views

Calculating azimuth of direction in OpenLayers? [closed]

I am developing an application with OpenLayers and I need to calculate the angle between two segments or directions. I thought about getting the azimuth of those segments and then calculate the ...
2
votes
2answers
137 views

OpenLayers overlay bubbling problem

Regarding on the previous question asked https://gis.stackexchange.com/a/303372/119333, solution from best answer is implemented and its working. I am rendering tab panel inside popup overlay and you ...
1
vote
1answer
313 views

On hover show feature information of features inside buffer ol5

I have created a buffer when user enter radius. Points are selected inside buffer but I dont know how to show feature information of selected features. Here is my code: var select = new ol....
0
votes
0answers
52 views

Is there any way to create measure tool (area and length) using Ext JS 6, GeoExt 3 and Openlayers 4?

I am building a web GIS application using Ext JS 6.0, GeoExt 3 and Openlayers 4.3.0. I want to make measure area and measure length buttons so when I activate button I can draw polygon or line and get ...
0
votes
1answer
127 views

Use PNG external graphic for vector layer with OpenLayers 5.3

I am currently working on a webmapping project using Mviewer device, linked to OpenLayers 5.3. I am trying to create a new vector layer to locate points, with js. So far, I managed to create a layer ...
1
vote
1answer
47 views

Openlayers getExtent() returns wrong values when the dataset crosses the dateline

I have a geojson with some data which I loaded into Openlayers. When I try to get the getExtent of the data source I get awkward values not corresponding to the extent of the data. The following image ...