openlayers-3

Change maxZoom option in runtime to ol.View in angular-openlayers-directive

匆匆过客 提交于 2019-12-10 17:15:25
问题 I posted this question to change maxZoom in runtime using openlayers3 and that works perfect: map.setView(new ol.View({ zoom: 10, maxZoom: 17, minZoom: 10, })); However, im trying to integrate this solution using the angular-openlayers-directive and the map is disappearing. Here a Plunker demo failing. I tried creating new directive and also didn't work. olData.getMap().then(function(map){ map.setView(new ol.View({ zoom: 11, maxZoom: 11, minZoom: 0, })); }); Any suggestions on how to

get coordinates of drawn feature in OpenLayers

拥有回忆 提交于 2019-12-10 13:44:54
问题 I'm trying to create an online map using OpenLayers 3. I'm brand new to using OpenLayers, and all I'm trying to do is to get the coordinates of the points, lines, polygons that I drew on the map. I'm aware that there is a featuresadded parameter available, but I'm not able to implement it correctly. Can anybody point me in the right direction how to get the coordinates of a drawn feature (either in an alert() or console.log)? Thanks a ton!! here's my code: <html> <head> <script src="http:/

where can i find a thorough description of implementing custom ol.style.Style in openlayers 3?

此生再无相见时 提交于 2019-12-10 12:19:17
问题 I've read through the source, and looked at the examples but haven't found the answer yet. I need to style the image that appears on the modify overlay beneath the mouse cursor. i'm using a custom style function to add midpoints and custom endpoints to the layer used by ol.interaction.Modify. ol.interaction.Modify is applying styling to a point near the mouse cursor to indicate that the feature can be modified. This is great except the cursor styling falls beneath the custom endpoints. i can

How to hide and show features in Open layers 3? (Redraw?)

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-10 11:02:17
问题 I'm updating a project from OL2 to OL3, but I'm stuck on how to redraw features after changing the feature style. In OL2, this worked: hidePoints: function(id) { if (! this.getMap().center) { return; } var i, feature, len = this.points.features.length; if (id !== null) { for( i = 0; i < len; i++ ) { feature = this.points.features[i]; if (feature.attributes.aces_id == id) { feature.style = null; } else { feature.style = { display: 'none' }; } } } else { for( i = 0; i < len; i++ ) { feature =

Openlayers 3 Reproject EPSG:4326 vector to EPSG:3857

被刻印的时光 ゝ 提交于 2019-12-10 10:07:51
问题 I am needing to transform GeoJSON vector data from EPSG:4326 to EPSG:3857... I have a map... var olMapDiv = document.getElementById('olmap'); control.map = new ol.Map({ target: olMapDiv, renderer: 'canvas', layers: layers, interactions: ol.interaction.defaults({ altShiftDragRotate: false, dragPan: false, rotate: false }).extend([new ol.interaction.DragPan({ kinetic: null })]), pixelRatio: 1, loadTilesWhileAnimating: true, loadTilesWhileInteracting: true, view: view }); and a view... var view

Displaying features based on zoom level

安稳与你 提交于 2019-12-09 03:30:31
I'm new to openlayers library and I got a question. I render a lot of features and when the map is zoomed out the features overlay each other, which looks pretty ugly, as you can see on the first screenshot. I'd like the zoomed-out map(first screen) to look like zoomed-in map(second screen) at all zoom levels. What would be the most common way of implementing it? Here is an example of a style function that detects group features from a cluster map layer and draws a square for individual object and circle for group objects: var styleFunction = function() { return function(feature,resolution) {

How do I decrease the size of Icon in openlayers 3, i am using bing maps

一个人想着一个人 提交于 2019-12-08 20:35:08
问题 This is my code: var iconFeature = new ol.Feature({ geometry: new ol.geom.Point(ol.proj.transform([-95.3698,29.7604], 'EPSG:4326' , 'EPSG:3857')), name: 'Null Island', }); var iconStyle = new ol.style.Style({ image: new ol.style.Icon({ opacity: 0.75, src: 'flag.png', height:10, width:10, }) }); iconFeature.setStyle(iconStyle); I have tried using anchor also, but I could not decrease the size, please help 回答1: ol.style.Icon takes a scale parameter that you can use to scale your icon. var

How do Bounds work in OpenLayers 3?

最后都变了- 提交于 2019-12-08 15:58:41
问题 Does the concept of OpenLayers.Bounds from OpenLayers 2.x still exist in OpenLayers 3? How has it changed, and what is its new name? 回答1: UPDATE: OL4: https://openlayers.org/en/latest/apidoc/ol.html#.Extent It seems that the new word for 'bounds' or 'bounding box' (BBOX) is 'extent'. See: http://openlayers.org/en/v3.20.1/apidoc/ol.extent.html http://openlayers.org/en/v3.20.1/apidoc/ol.View.html#fitExtent http://openlayers.org/en/v3.20.1/apidoc/ol.source.Vector.html#getExtent One way to find

How to disable DragPan in OpenLayers 3?

独自空忆成欢 提交于 2019-12-08 15:35:16
问题 How to disable DragPan interaction in Openlayers 3 (when map is already defined)? Also, why I'm unable to use mousemove event? I'm doing this: map.on('mousemove',function(e){ ...}); and it doesn't work. 回答1: To disable an interaction, you need to remove it from the map . If you don't have a reference to your interaction, you can find it using the getInteractions map method: var dragPan; map.getInteractions().forEach(function(interaction) { if (interaction instanceof ol.interaction.DragPan) {

Why does my OpenLayers 3 map not show in Internet Explorer 11?

冷暖自知 提交于 2019-12-08 15:11:30
问题 I am trying to serve up a map in Internet Explorer that works fine in Firefox or Chrome. While debugging I noticed that something was missing when I tried to bring up the map in IE. This is the html that is in Firefox with the working map: This is the html that is missing essential elements for the map: This occurs after I draw a bounding box and submit a search, the search is supposed to find and results that are in the bounding box. Then draw the whole area that each result covers. When the