openlayers-3

openlayers-3 in node.js app?

狂风中的少年 提交于 2019-12-07 07:37:59
问题 I'm interested in using ol3 in a node.js app (e.g. the ol.format APIs for reading GeoJSON). Is that a supported use case? I ask because it doesn't appear to work by just running npm install openlayers and then requiring it. var ol3 = require('openlayers') fails on code that's looking for the geolocation property of the window.navigation object since the window.navigation doesn't exist in a node.js environment TypeError: Cannot use 'in' operator to search for 'geolocation' in undefined at

Is Displaying 1000+ Feature Footprint Vectors on OpenLayers Map with Good Performance Possible? [closed]

℡╲_俬逩灬. 提交于 2019-12-06 16:29:50
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . When loading many feature footprint vectors onto the map, the openlayers map and web application becomes unresponsive. Is there any way to improve the performance of the openlayers map with many vectors? We would like to be able to support at least 1000 vectors on the map at once. We are using openlayers 4. As I

getFeatures() is empty

我是研究僧i 提交于 2019-12-06 15:13:45
问题 I have a similar question like POI in OpenLayer 3 but not the same. I'm drawing a map with an KML File: var layerVector = new ol.layer.Vector({ source : new ol.source.KML({ projection : projection, url : _url }), }); It works fine and I can see the points from the KML file in the map. (Using <Style> and <styleUrl> Tags in the KML file.) But if I try to see the features i get an empty Array. console.log( layerVector.getSource().getFeatures() ); ==> Array [ ] any idea? thx mx 回答1: See the

Draw a circle with defined diameter in OpenLayers

一世执手 提交于 2019-12-06 11:52:19
I'm trying to write a code which let my users define some points on the map and once they created a point, the program should draw a circle with defined diameter(in kilometers or ... ) around the point. I can draw a point but I don't know how I could handle what I said. Here is an example about what I want: Use the following function to create circular points around a point. //pass the //@pointX, //@pointY, //@radius of circle (in your case diameter/2) //@pointsToFind this is how detail you want the circle to be (360 if you want one point for each rad) function createCirclePointCoords

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

房东的猫 提交于 2019-12-06 11:26:27
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 = this.points.features[i]; feature.style = { display: 'none' }; } } this.points.redraw(); }, In OL3, I

Fixed icon size in OpenLayers 3

久未见 提交于 2019-12-06 10:39:06
I searched for 2 hours now, but it's still not clear if it's possible or not in OL3. I would like my icons to be fixed size (not to the screen, but to the image map I'm using). I mean, it should cover the same area even if I'm zoomed out, and not covering the half of the map (like I was using a circle polygon, but I have complex Icons so I have to use it as point features). Is there any solution to it? Like in QGIS: MAP UNITS. I already have these: var jelekStyle = function(feature, resolution) { if(feature.get('tipus')=== 'falu') { icon = '00_ikonok/falu.png', size = [115, 233], scale = 0.05,

Set style zoom level openlayers 3

狂风中的少年 提交于 2019-12-06 09:41:19
In Openlayers it was possible to turn certain features on or off depending on the zoom level. I have not found the same functionality in OpenLayers 3 despite looking through the documentation. Does anyone know how to do this? This is the feature I'm placing on the map and ol.style.Text is what I would like to display only after the user is zoomed in to a particular zoom level. var geoJsonObj = { 'type': 'Feature', 'geometry': JSON.parse(response.FieldList[key].Shape) } var vectorSource = new ol.source.Vector({ features: (new ol.format.GeoJSON()).readFeatures(geoJsonObj) }); Fields[Field

Using Tiled Google Map With OpenLayers 3

只愿长相守 提交于 2019-12-06 09:33:44
问题 How can I use google map with OpenLayers 3? I want to migrate from OpenLayers 2 to 3. here is an example: google map integration with OpenLayers example but using this method needs to change the old HTML code (two element needs, 'gmap' and 'olmap' that mentioned in the example). Google Maps is officially not supported by ol3, but my question is: "How can I use Google Maps Tile Service in my project like a MapServer, without needing to add google API reference (for optimizing purposes) to the

OpenLayers 3 and XYZ Layer

荒凉一梦 提交于 2019-12-06 09:02:04
问题 I have a map, which I want to display. It consists of a standard map (OSM, Google or Bing) and a layer, provided by Openseamap.org. This layers produces seamarks as images for a map. This should look like this (more or less, without the pink screen): I am trying to transfer this to OpenLayers3. The JavascriptCode I used is: var map = new ol.Map({ target: 'map', layers: [ new ol.layer.Tile({ source: new ol.source.OSM() }), new ol.layer.Tile({ source: new ol.source.XYZ({ url: 'http://tiles

Is there anyway to specify z-order of feature on single layer?

心已入冬 提交于 2019-12-06 06:36:47
问题 I am using single layer with three feature and would like to specify z-order but not working anyway. As per my understanding feature is drawing in same order in which I am adding so I tried by adding in reverse order but it not worked for me. Code to add feature var features=[]; jQuery.each(data.route, function (key, val) { var localfeature = new ol.Feature({ geometry: objGeoJSON.readGeometry(JSON.parse(val.simpleRoute)).transform('EPSG:4326', 'EPSG:3857') }); localfeature.set("rtype", "R" +