openlayers-3

Smoother loading of tiles in OpenLayer

一世执手 提交于 2020-02-23 05:56:29
问题 I would like to improve the loading experience of my maps displayed with OpenLayer. At the moment, the loading of new tiles is not very smooth, especially when loading tiles in an empty area of the map. I would like to animate the apparition of the new tile, for example by playing with the opacity of the new image to display. I have the feeling that this is what leaflet is doing. The problem is that I did not find a way to listen when a tile is ready to be displayed and even less how to

How to precache tiles with OpenLayers for date animation

巧了我就是萌 提交于 2020-02-01 07:37:08
问题 I am working on animating an OpenLayers map with multiple layers over a period of time. I would like to precache ol.layer.tile tiles to have smooth transitions between the dates. Any suggestions on how to precache/preload these tiles? 回答1: You'll want to rely on your browser cache here. And it requires that your server sends proper cache headers, so the browser does not re-fetch the images with every request. With these prerequisites in mind, proceed as follows: Call ol.source.TileImage

On openlayers 3, how do you pause a change event when updating features?

浪尽此生 提交于 2020-01-25 04:40:45
问题 Basically, i have to update multiple features, specifically setGeometry, but everytime an update is applied on single feature, the change event is triggered, causing the layer to be redrawn. So, if there are 500 features updated, the layer will ve redrawn 500 times. I would like to payse the redraw event, untill all features are updated. Update: One of the workaround that i can think of is: getFeatures() clear(true) (Updates the features) addFeatures(features) But i'm not sure if there's a

In openlayers 3, how to fill the polygon with a picture from a url?

丶灬走出姿态 提交于 2020-01-25 04:40:09
问题 I would like to add a picture in the polygon, however, I do not find such function in openlayers 3. Is there any way to achieve this? Thanks in advance! 回答1: Since Pull Request #4632 you can use a CanvasRenderingContext2D.fillStyle as ol.style.Fill#color property and create a pattern. Something like this: var cnv = document.createElement('canvas'); var ctx = cnv.getContext('2d'); var img = new Image(); img.src = 'https://i.imgsafe.org/73d1273.png'; img.onload = function(){ var pattern = ctx

Preload tiles before animation

大憨熊 提交于 2020-01-23 03:22:06
问题 I am currently doing some animation (smooth zooming & panning) in OpenLayers using ol.animation, but sometimes those animations are too fast to show smooth zooming (tiles do not load fast enough) - which is expected behaviour. But animation on my page starts only after viewer reads whole post (~1min), so I thought I could preload tiles that are needed for the animation in this time of inactivity. Is there possibility to preload tiles of a layers/map? I was thinking some solutions: Create

OpenLayers 3 Image and Text style zindex

我只是一个虾纸丫 提交于 2020-01-16 18:01:50
问题 I've noticed that text and image styles don't seem to respect their layer order when being rendered. For example, when many features with these styles are close together, all the text is rendered on top of other overlapping vector features. Is there a way to disable or override this behavior? Thanks. myFeature.setStyle(new ol.style.Style({ image: new ol.style.Icon({ src: '/images/myImage.png', anchor: [0.5, 1], anchorXUnits: 'fraction', anchorYUnits: 'fraction' }) })); myOtherFeature.setStyle

openlayers error on draw/modify (in vuejs)

[亡魂溺海] 提交于 2020-01-16 09:14:10
问题 The code I am using is in my previous question (resolved) The interaction works perfectly and my goal is to get an array of coordinates, also works perfectly. Although everything works, I am getting an error in console every time I move the mouse in the display area. It doesn't affect functioning, but obviously I need to solve it... any ideas? Draw.js?ac29:579 Uncaught TypeError: Cannot read property 'getGeometry' of null at Draw.modifyDrawing_ (Draw.js?ac29:579) at Draw.handlePointerMove_

How to indicate polygon vertices with small circles using OpenLayers?

空扰寡人 提交于 2020-01-15 23:38:54
问题 I am using OpenLayers 3 and have more or less implemented everything in my requirements list, except one thing: I am asked to somehow make the polygon rendering indicate the polygon vertices with small circles. In plain words, the desired polygon outline is not just a line - it is a line "adorned" with small circles in all the places where there is a vertex. How can I do that in OL3? I searched in the ol.style.Style docs (that is, the style I pass via setStyle to the ol.layer.Vector

How to indicate polygon vertices with small circles using OpenLayers?

喜夏-厌秋 提交于 2020-01-15 23:37:03
问题 I am using OpenLayers 3 and have more or less implemented everything in my requirements list, except one thing: I am asked to somehow make the polygon rendering indicate the polygon vertices with small circles. In plain words, the desired polygon outline is not just a line - it is a line "adorned" with small circles in all the places where there is a vertex. How can I do that in OL3? I searched in the ol.style.Style docs (that is, the style I pass via setStyle to the ol.layer.Vector

openlayers3 same style for selected features (only one changed property)?

佐手、 提交于 2020-01-15 20:26:05
问题 I have an ol3 layer with a style definition. I would like to use the same style for the select interaction: style = function(feature, resolution) { var iconFont = 'FontAwesome'; var iconFontText = '\uf1f8'; // fa-trash var iconSize = 24; var col = 'black'; var styles = []; var styleIcon = new ol.style.Style({ text: new ol.style.Text({ font: 'Normal ' + iconSize + 'px ' + iconFont, text: iconFontText, fill: new ol.style.Fill({color: col}) }) }); styles.push(styleIcon); } return styles; }; new