Questions tagged [openlayers]

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

736 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
1
vote
0answers
30 views

Vertically fit an Open Layers map in a div

I've created an Open Layers map similar to this example I've mocked up: https://codesandbox.io/s/seamlessly-repeating-vectorlayer-forked-igqti?file=/main.js [EDIT: The above link now shows a commented ...
1
vote
0answers
39 views

Read the attributes of a WMS layer by clicking on the map

I'm trying to display a popup (containing the attribute data) by clicking on an entity in my layer with the WMSGetFeatureInfo control from OpenLayers. It's turning but without displaying the popup ...
1
vote
0answers
35 views

Determine if a polygon feature is within a projection range in Openlayer 4

This question comes following a previous one that I posted yesterday (link). I have to show on a World Ocean Base map (projected as EPSG:3857) a number of areas. These are contained in a series of ...
1
vote
0answers
27 views

How to synch Zoom control and MouseWheelZoom interaction in OpenLayers 6?

In OpenLayers v6.3.1 the map has a Zoom control and MouseWheelZoom is enabled. The map view has 10 resolutions. In OpenLayers v5 prior to v6 using either the Zoom control or the MouseWheelZoom ...
1
vote
0answers
140 views

OpenLayers Map Click Event not getting called in ReactJS

Problem: OpenLayers(v6.3) MAP is visible in REACTJS(16.13) but click event on MAP is not getting called. Purpose: I want to place a marker and handle its click event to show some POPUP with data. Code:...
1
vote
0answers
38 views

OpenLayers 3+: Start/end icons

How to create markers/icons at the startpoint and endpoint automatically in OL/JS? I'm doing this right now - I know startpoint and endpoint from PHP analysis: var startpoint = new ol.Feature({ ...
1
vote
0answers
36 views

OpenLayers 6 add rulers

I'm trying to add vertical and horizontal rulers on top of my map. In OpenLayers 2 I have seen code that had VerticalRuler and HorizontalRuler as attributes but I can't find something similar in ...
1
vote
0answers
66 views

openlayers 6: measure tool dosen't show up drawn shapes

I am working on a laravel project, where I need to insert a map in the interface of my application. I am using openlayers V6.3.1 to create the map with its basic tools. I still have a problem, measure ...
1
vote
0answers
215 views

OpenLayers React export map and vector layers

For my project I am trying to export the map I have created with all it's Vector layers. I can't seem to get the example I found on the site of OpenLayers to work in React. The export doesn't need to ...
1
vote
0answers
37 views

Experience with issues faced while upgrading from OpenLayers 4 to 6

We are thinking of migrating from OL 4 to 6, skipping 5. I read the upgrade notes, but I wanted to know if someone here also jumped from v4 to v6 and their experience if they faced any major hurdles ...
1
vote
0answers
32 views

How to change Openlayers MousePosition control as mouse up?

I am using openlayers 6.x and Mouse position control. this.control = new MousePosition({ coordinateFormat: createStringXY(this.precision), className: this.className || "mouse-position", target: ...
1
vote
1answer
175 views

WMS GetFeatureInfo request with buffer doesn't return any result (OpenLayers/MapServer)

I'm using OpenLayers 4 to build a GetFeatureInfo URL with a buffer parameter to a WMS layer in MapServer in order to find the closest feature of the layer given some specific coordinates. The problem ...
1
vote
0answers
20 views

Blured tiles while loading map

It might be a stupid question but I need to ask it. On the latest version of OpenLayers which is using OSM tiles, when you are quickly zooming map the tiles which are not loaded yet gets blurry: On ...
1
vote
1answer
155 views

Loading GeoJSON in OpenLayers?

I am trying to load GeoJSON in OpenLayers, however, the polygon isn't visible on the map. What am I doing wrong? <!doctype html> <html lang="en"> <head> <link rel="...
1
vote
0answers
25 views

OpenLayers how to style features when importing from GeoJson file?

I'm attempting to style features based on their attributes from a GeoJSON file, however I'm having difficulties Styling code: //Style var styleFunction = function (feature) { var ...
1
vote
0answers
36 views

OpenLayers how to show long lat after click to map and make visible until next click to map?

I found this code for make visible long lat coordinate after moving the mouse over the map. And I rewrite to HTML page with newest OpenLayers version. I would like to show this long lat coordinates ...
1
vote
0answers
44 views

Adding 500 features dynamically to OpenLayers 4.6.5

I have a tile layer, three vector layers. I want to add 500 features dynamically to one of the vector layer using OpenLayers 4.6.5. It is currently working with 300 features and anything more than 300 ...
1
vote
0answers
26 views

Publishing raster data in OpenLayers applications

I need tips for publishing raster data in my OpenLayers application.I published shapefiles through my postgis db (PgAdmin) to geoserver, not sure how to do that for raster? I readed that is not ...
1
vote
0answers
217 views

Jumpy mouse wheel zoom in OpenLayers

I'm using ol.View option constrainResolution: true so that mouse scroll zooming has the same zooming steps as clicking in + or - zoom control. There are no custom view resolutions set, just plain XYZ ...
1
vote
0answers
69 views

Prevent results of GetGeometry from disappearing after AJAX call

In my ongoing mission to try to find a way to zoom into a specific area of a map (in this case a DMA), I am first trying to get the coordinates of a selected point that will be accessible to me for ...
1
vote
0answers
23 views

GeoJSON vector data tiles disappear

I found an example of how to show GeoJSON data on cesium and I followed that example The data is displaying but tiles are disappearing when I zoom in more and more I tried with same with us sample ...
1
vote
2answers
129 views

Loading points from an array given by PHP query from MySQL db to OL

New to OpenLayers and JS in general. I have some coords stored as lat long, then PHP script which load these points from MySQL db and simply print it as follows: var points = [[49.66356869941062, 16....
1
vote
0answers
29 views

OpenLayers JavaScript bug when dragging outside the map element

I'm trying to learn OpenLayers. But the project I try to create has a bug when moving the mouse outside of the map HTML element when dragging the map. When you try to navigate by keeping the left ...
1
vote
0answers
92 views

OpenLayers 6 TileWMS over server-side proxy script

Let's say I've simple PHP proxy script: $ch = curl_init($_GET['url']); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $output = curl_exec($ch); curl_close($ch); ...
1
vote
0answers
38 views

Predict the movement of an object on the map considering geodetic calculations in OpenLayers 3?

I need to represent the movement of an object (which has its own speed) but considering the geodedic calculations. I'm working with EPSG:3857 projection. How can I do this?
1
vote
0answers
700 views

Drawing circle of specified radius in meters using OpenLayers 3

I need to present a mask where the user put the radius (in meters) to draw a circle. How can I do this? Do I have to do geodesic calculations to get a circle that follows the projection of the map (...
1
vote
0answers
84 views

Show overlay on top when zoom out in OpenLayers 4.6.5?

I have a tile layer, three vector layers. The tile layer has lots of overlays in it. I want to put vector layers on top when zooming out the map using OpenLayers 4.6.5. I tried to apply setLayerIndex ...
1
vote
0answers
36 views

OpenLayers.Format.WMTSCapabilities vs ol.source.WMTS

Struggling with getting a WMTS layer working using OL2. I have it working with OL3 but unfortunately I'm working with legacy code and it needs to work on OL2. Using OL3 (working) var xml = '...'; //...
1
vote
0answers
47 views

Use a WFS-T layer in d3.js without adding a background map?

I am currently working on a d3.js project and would like to include a WFS-T layer to my SVG map to display and update location data stored in a PostGIS database. I know that I need to transform my ...
1
vote
0answers
35 views

Managing images on OpenLayers

I am working on a web application with OpenLayers 6 currently, and it is my first foray into OpenLayers. I have managed to get the application to allow drawing and retrieval of images based on those ...
1
vote
0answers
94 views

OpenLayers GeoServer update an array of features using WFS-T

I am trying to update features using WFS-T update. I am sending the request from my website (OpenLayers) by passing an array of features. However, I have noticed that the attributes and geometry of ...
1
vote
0answers
76 views

How to change OpenLayers Map styles with bright.json

I got problem with using Bright.json I caant load that styles to map. So far I got let vLayer = new ol.layer.Vector({ source: new ol.source.Vector({ url: "/www/bright.json", ...
1
vote
0answers
70 views

How to add text to LineString in OpenLayers?

We use OpenLayers 4.6.5. The code looks as following: const line = new Feature({ geometry: new LineString(points) }) line.setStyle( new Style({ fill: new Fill({ color: 'black' }), stroke:...
1
vote
0answers
797 views

OpenLayers 6.1.1 add layer to existing layer group in ol-layerswitcher

I have a productive site with OpenLayers 4.6.4 and want to switch to the actual 6.1.1 version. Since there where changes in the code I have to adapt mine to get everything work again. Actually I'm ...
1
vote
0answers
75 views

Displaying Vectortile Source using ngx-openlayers

I downloaded a tileset from OpenMapTiles and host it with tileserver-gl, what is working just fine. Now I want to load and display the vector tiles in an Angular 7 application using ngx-openlayers, ...
1
vote
1answer
187 views

OpenLayers select.on event listener fires multiple times (renders multiple)

I am using hook React My question is to render event only once instead multiple times useless When I am selecting a feature, it renders multiple times var select = new ol.interaction.Select(); ...
1
vote
0answers
76 views

Openlayers 6, App crashes when I set too many text labels

I'm looking for an efficient way to set conditionally text for over 3000 features. Below is a little code on how I do it now, but my Android App freezes and crashes sometimes because it exceeds the ...
1
vote
0answers
119 views

Is it possible to zoom to custom map center with Zoom Controls?

The OpenLayers example Advanced View Positioning shows how to create a “view inside a view”. If you examine the example, it uses a padding passed to view.fit(), from which you can correctly zoom to ...
1
vote
0answers
29 views

Zoom to extent using geom or xmax, ymax?

I made a function to zoom to polygon geom if I click the button. This is my script: $.ajax({ type: "POST", url: 'core/zoomtolocation', data: { ...
1
vote
0answers
94 views

Get all displayed layers currently visible in the map

Angular: 8 Openlayers: 5.2 I am trying to build a dynamic legend that only shows the displayed layers in the map. With a getLegendGraph from mapserver I want to create the legend. This works great ...
1
vote
0answers
53 views

Kinetic properties in OpenLayers 6

I'd like to know how to adjust properties of ol/Kinetic. And also, what are the default properties when using the default ol/interaction/DragRotateAndZoom ? Properties are decay, minVelocity and ...
1
vote
0answers
41 views

OpenLayers: disable selection from label of feature

I have a feature with a circle and a text attribute. The text attribute is displayed via a text-style above the circle center. The current behavior: I can select feature from text style label. The ...
1
vote
0answers
100 views

Delete drawn vectors from map in OpenLayers 3

I have a map where I want to draw features as well as displaying their attributes. This I have done without problems. My problem is that I want the layers to be deleted from the map when pressing the ...
1
vote
0answers
80 views

How to make maps move when you create a Google map using OpenLayer 2

<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="viewport" content="width=device-width, initial-scale=...
1
vote
0answers
31 views

Add a cursor/icon in OpenLayers to mark precisely

We are using OpenLayers in a mobile application developed in Ionic. When we trace any feature (Point/Line/Polygon) by using finger precision is not accurate and user is not able to exactly mark the ...
1
vote
0answers
43 views

Migration from ol2 to ol6 fixed strategy missing

I try to migrate from ol2 to ol6. My ol2 uses OpenLayers.Strategy abstract class with Fixed() and BBOX members: var strategy = layerData.Strategy == "fixed" ? new OpenLayers.Strategy.Fixed() : new ...
1
vote
0answers
160 views

OpenLayers GeoLocation.getPosition() is inconsistent

In my mobile application I am using OpenLayers and trying to capture current position of the user by using GeoLocation.getPosition() method. The method sometimes returns position and sometimes return ...
1
vote
0answers
39 views

Draw several lines to represent the distance to a certain point for several points

It gives a certain point that I want to analyze. I want to see what is the distance of that point from the rest of the x points on the OpenLayers map ... The data comes from external JSON in the ...
1
vote
0answers
836 views

Uncaught Reference Error: init is not defined

I am getting the above error on my HTML file @ line number 22. I tried several attempts and was unable to resolve it. Here is the HTML code: <!DOCTYPE html> <html lang="en"> <head&...
1
vote
0answers
43 views

2D canvas library for OpenLayers. Drawing custom interactive objects

I am looking for the 2D canvas library like Konva.js that I can use above OpenLayers 5.x. I need to draw shapes with font inside that are interactive - can be dragged over the map to the appropriate ...

1 2 3
4
5
15