openlayers-3

OpenLayers 3: Offset stroke style

浪子不回头ぞ 提交于 2021-02-08 08:52:48
问题 I have LineString features styled by a single stroke. Some of these features represent two things, so in addition to the initial stroke color, I would like to have a parallel line next to it in a different color. This would be a no-brainer if ol/style/Stroke had an offset property like ol/style/Image does, but sadly, it does not. If I created offset geometries for those features, they wouldn't be visible from a zoomed out level. What are my options? 回答1: You can offset the geometries based on

OpenLayers 3: Offset stroke style

天大地大妈咪最大 提交于 2021-02-08 08:52:28
问题 I have LineString features styled by a single stroke. Some of these features represent two things, so in addition to the initial stroke color, I would like to have a parallel line next to it in a different color. This would be a no-brainer if ol/style/Stroke had an offset property like ol/style/Image does, but sadly, it does not. If I created offset geometries for those features, they wouldn't be visible from a zoomed out level. What are my options? 回答1: You can offset the geometries based on

How to use a different tile provider in openlayer3

你。 提交于 2021-02-08 07:41:16
问题 I am looking for detailed steps to implement this tile provider https://leaflet-extras.github.io/leaflet-providers/preview/ or http://mapstyle.petschge.de/ I am newbie where i am not knowing how to go about in implementing to the existing code which is shown below <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title>Simple map</title> <link rel="stylesheet" href="http://openlayers.org/en/v3.0.0/css/ol.css" type="text/css"> <style> </style> </head> <body> <!--html element

How to use a different tile provider in openlayer3

可紊 提交于 2021-02-08 07:40:28
问题 I am looking for detailed steps to implement this tile provider https://leaflet-extras.github.io/leaflet-providers/preview/ or http://mapstyle.petschge.de/ I am newbie where i am not knowing how to go about in implementing to the existing code which is shown below <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title>Simple map</title> <link rel="stylesheet" href="http://openlayers.org/en/v3.0.0/css/ol.css" type="text/css"> <style> </style> </head> <body> <!--html element

OpenLayers 3 hover to highlight only one specified object per time

孤街醉人 提交于 2021-02-07 10:28:19
问题 Original issue: OpenLayers 3 (tested also newest 3.14.1) should have some sense in the way it selects features that overlap each other. When multi=false it selects only one feature, but picks it quite randomly. When you hover over certain features from different directions, different feature is selected. I have tried to tangle this by setting z-index to features to tell Openlayers the desired order. Indexing is set to order point > line > polygon but still I am not getting point selected

How do I create a distance scale ring in SVG in openlayers 3?

♀尐吖头ヾ 提交于 2021-01-29 12:54:56
问题 I want to draw an SVG distance ring on one of the layers in openlayers 3, centered around the center of the screen.Draw each ring in screen coordinates. The distance between each ring represents the distance on the map. The distance between each ring varies as the map scales. 回答1: It's probably best done using OpenLayers own styling capabilites. For example, adding a dummy layer with feature covering the whole extent which can be styled as rings around the map center. Note that depending on

Open Layers 3 - Initialize Draw Interaction with first node on LineString

别来无恙 提交于 2021-01-28 18:08:45
问题 I have a map where a user can choose some object/feature on the map and draw a line to another object/feature. When the user selects the feature i would like do add a draw interaction and already set the first point to the selected feature without the user having to click again on the map. Here is a fiddle: Sample The commented code below should be executed programmatically without user interaction, after pressing the draw button geometryFunction: function (c, g) { if (goog.isDef(g)) { g

Open Layers 3 - Initialize Draw Interaction with first node on LineString

放肆的年华 提交于 2021-01-28 18:06:48
问题 I have a map where a user can choose some object/feature on the map and draw a line to another object/feature. When the user selects the feature i would like do add a draw interaction and already set the first point to the selected feature without the user having to click again on the map. Here is a fiddle: Sample The commented code below should be executed programmatically without user interaction, after pressing the draw button geometryFunction: function (c, g) { if (goog.isDef(g)) { g

How to execute some code whenever the user interacts with the map?

扶醉桌前 提交于 2021-01-28 02:58:56
问题 I have an OpenLayers 3.9.0 map. I also have a pair of LonLat coordinates that I am tracking from an external source and updating onto the map. I am continuously re-centering the map on these coordinates: function gets_called_when_I_have_updated_coords() { map.getView.setCenter(coords); } What I want is to disable this auto-centering whenever the user interacts with the map. In other words, I want this: var auto_center = true; function gets_called_when_I_have_updated_coords() { if (auto_center