openlayers-3

Drag and Drop Feature in Openlayers 3

若如初见. 提交于 2019-12-11 03:15:45
问题 What is the equivalent for the OpenLayers 2 "OpenLayers.Control.DragFeature" functionality. I need to add an Icon to a map, that is moveable with the mouse. When dropping I need to catch the event. In OpenLayers 2, the described functionality is: new OpenLayers.Control.DragFeature(this.MarkersLayer, { onComplete: function(feature, pixel) { /* here comes the action after dropping the marker */ }} Does anyone has an idea how this can be accomplished with OpenLayers 3? 回答1: OpenLayers 3 now

Get coordinates from snap in openlayers

时间秒杀一切 提交于 2019-12-11 02:32:36
问题 Welcome and greetings! How to get coordinates of features from snap function? I am using this example OpenLayers website: http://openlayers.org/en/latest/examples/snap.html?q=snap I tried to do it this way: snap.on('select', function(evt) { var coord = evt.selected[0].getGeometry().getCoordinates(); alert(coord); }); But is not working. I need to use 'select','drawend',modifyend' events. 回答1: I had a hard time finding a solution to this myself but after debugging the ol code I came up with

How to use OpenLayers 3 with Proj4js

与世无争的帅哥 提交于 2019-12-11 02:20:29
问题 I'm working on a map viewer project and used openlayers 2 before this. Now I have to use OpenLayers 3 and map viewer app should support many different projections because I have wms and wfs layers from different sources and projections. I've found examples that use openlayers2 and proj4js. But I couldn't find explicit example for using ol3 and proj4js. What is your suggestion? 回答1: It seems that sometimes, like when using OpenLayers 3 and proj4 in Angular 2 using webpack, one needs to

Can't use openlayers-3 with webpack

末鹿安然 提交于 2019-12-11 01:55:47
问题 I have to include openlayers in a project that I am working on. I have tried both including it in a ext folder and by npm. I am using Webpack in my workflow. On compilation I get the following warning in my console. WARNING in ./~/openlayers/dist/ol.js Critical dependencies: 730:1111-1118 This seems to be a pre-built javascript file. Though this is possible, it's not recommended. Try to require the original source to get better results. @ ./~/openlayers/dist/ol.js 730:1111-1118 Any idea what

openlayers 3: how to draw sth using canvas.getContext('2d') on top of the map

不想你离开。 提交于 2019-12-11 01:46:26
问题 I want to draw some geometry in the map using canvas.getContext('2d'). However, the geometry I've drawn just show for a while. It disappear when I pan/zoom the map. How can I draw a permanent geometry through this way? Below is my code: <html> <head> <title></title> <!-- styles --> <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/ol3/3.19.1/ol.css"/> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/ol3/3.19.1/ol.js"></script>

OL3 / Geoserver: Vector tile labels gets cropped

巧了我就是萌 提交于 2019-12-11 00:58:32
问题 I am trying to label vector tile point features but they always gets cropped at the tile border. I have tried (among many other things) using the renderBuffer option with no success. I am using OL 3.19 and the vector tiles are served with Geoserver 2.10RC1 and I get the same errors in my production environment as well as editing an Boundless example (http://suite.opengeo.org/docs/latest/dataadmin/vectortiles/index.html). I think maybe the tiles are served correctly from Geoserver and that

Disable interim tiles for tile layer

你说的曾经没有我的故事 提交于 2019-12-11 00:44:41
问题 When creating a map like this: var map = new ol.Map({ loadTilesWhileAnimating: true, loadTilesWhileInteracting: true }) OpenLayers 3 uses interim tiles (i.e., previously loaded lower resolution tiles) when zooming and panning until it has finished loading the new tiles. The interim tiles are placed behind the real tiles. Which is very clever, and is great for opaque layers, but much not so great for mostly transparent layers. We currently have a layer which consists of just a few lines, only

Popover overlay in OpenLayers 3 does not extend beyond view

江枫思渺然 提交于 2019-12-11 00:22:33
问题 In the OpenLayers overlay example: http://openlayers.org/en/v3.11.2/examples/overlay.html If you click near the top of map most of the overlay is hidden. Is there a CSS trick, or an OpenLayers setting (I do not want to use the autoPan, which doesn't seem to work for popovers anyway), that will enable the entire popover to be shown even if it extends beyond the map view? Here's a screenshot that illustrates the problem. 回答1: autoPan does work for popups, see here: http://openlayers.org/en/v3

Display Markers, Popups with OpenLayer3

自作多情 提交于 2019-12-10 20:10:24
问题 I'm trying to understand how can I display markers/popups on osm map with openlayers3, I have found examples in examples on ol3 web page, but... Is there more examples for coding markers/popups with javascript or jquery, preferably something like this or similar examples. The idea is to mark a building, by clicking on the marker it will popup some info for the building, further more I would like to connect important places from the city to this building (library, restaurants, bus stops, etc).

OpenLayers 3 - tile canvas context

这一生的挚爱 提交于 2019-12-10 17:47:58
问题 I am trying to reproduce this example on OL3 (3.6.0) using the code below. I am having trouble to get image context to do getImageData() and putImageData() on OSM event tileloadend . Any guide will be very appreciated. function map_create (div_id, lat, lng, zoom, hide_controls) { vectorSource=new ol.source.Vector(); vectorLayer=new ol.layer.Vector({source: vectorSource}); osm=new ol.source.OSM(); osm.on("tileloadend", function(evt){ /*var size=evt.tile.getTileCoord(); console.log(size);*/ var