openlayers-3

Make marker zoom/rotate with map in Openlayers 3

房东的猫 提交于 2019-12-22 14:14:36
问题 I'm trying to overlay an image over an OpenLayers 3.0 map by adding a point feature to the layer, and setting the icon to the image to load. How can I get it to scale with the map as it is being zoomed? Or is there a better way to overlay an image atop a layer? p=ol.proj.transform( [-78,40],'EPSG:4326','EPSG:3857') var f=new ol.Feature({ geometry: new ol.geom.Point(p) }); var imgStyle=new ol.style.Style({ image: new ol.style.Icon(({ rotateWithView: false, anchor: [.5,.5], anchorXUnits:

How to delete a listener in OpenLayers 3

匆匆过客 提交于 2019-12-22 05:29:43
问题 I make a copy of my question here at stackoverflow, because at gis.stackexchange all my questions do not attract any attention - many times I could not get an answer to simple questions there. So, my question now is how to delete a listener defined this way: map.getViewport().addEventListener('click', function (e){ console.log("clicked"); }); 回答1: OL3 emmits its own kind of events you could use instead and, to answer your original question, gives an easy and quick way to unregister them. Look

Use Semantic-UI (or Font Awesome) icons as markers in OpenLayers3

ⅰ亾dé卋堺 提交于 2019-12-22 04:36:15
问题 Is there a way to use icons from Semantic UI or FontAwseome as markers icons in OpenLayers3 ? OpenLayers features the feature style Text that can be used as follows: var blackFill = new ol.style.Fill({color: 'black'}) var whiteStroke = new ol.style.Stroke({color: 'white', width: 1}) var iconText = new ol.style.Text({font: "<my font>", text: "<some string>", fill: blackFill, stroke: whiteStroke }) var featureStyle = new ol.style.Style({ text: iconText }); After checking the style of Semantic

node.js and geoserver CORS

主宰稳场 提交于 2019-12-22 02:31:10
问题 I have node.js server 0.10.12 and express.js 4.8.5. Node.js is the web server, includes openlayers 3.9.0. Geoserver 2.1.3 serves the WMS layer. Later, I will implement vector layers. There is only one route (for the index page) var routes = require('./routes/index'); The index.js contains var express = require('express'); var router = express.Router(); router.get('/', function(req, res, next) { res.render('index', { title: 'openlayers3 testing', head: 'Welcome' }); next(); }); module.exports

Openlayers 3 center map

梦想的初衷 提交于 2019-12-22 01:38:14
问题 I'm sing OpenLayers 3 to display a map. I want to center the map using latLon coordinates. I'm using the quickstart code to begin with. Using this code, I cannot change the center of the map. I think this has something to do with Spherical Mercator projection . Only thing is, I only have lat lon coordinates. Does anyone know how to center a map from openlayers v3? 回答1: You need to transform the lon/lat coordinates to the correct projection (or coordinate system) using var olCoordinates = ol

OpenLayers and TypeScript?

ⅰ亾dé卋堺 提交于 2019-12-21 17:11:06
问题 I was wondering if anybody knows if there are any existing TypeScript definition files for OpenLayers (or if they are already in the making). I tried parsing the OpenLayers source files myself and use the documentation comments to build a TypeScript definition file but to really make this work I would need a complete JavaScript parser that also understand the documentation syntax in OpenLayers (it uses NaturalDocs, http://naturaldocs.org) and I'm beginning to think that translating the info

Check if a point is inside polygon in OpenLayers 3

这一生的挚爱 提交于 2019-12-21 09:14:28
问题 When I draw a polygon in an OpenLayers map, I want to know if the marker is inside the polygon or not. I searched in the OpenLayers API, but didn't find a solution. And you can see my full code in this link. I have the impression that I have to modify this function: function addInteraction() { var value = typeSelect.value; if (value !== 'None') { draw = new ol.interaction.Draw({ source: vectorSource, type: /** @type {ol.geom.GeometryType} */ (typeSelect.value) }); map.addInteraction(draw);

OpenLayers: How to detect the map view is completely loaded?

。_饼干妹妹 提交于 2019-12-21 04:25:06
问题 I'm implementing map exporting functionality using OpenLayers 3. But there is one problem: one cannot determine whether the map view is completely loaded or a few tiles is missing yet. It seems there is no such API or event. The close one is tileloadstart - tileloadend pair. But OpenLayers loads tiles asynchronously, and before the tile is actually loading the tileloadstart is not fired - that is, a tile that is queued in the tile queue does not fire the event before actually loading. Hot can

How to get coordinates on double click on Openstreetmap?

巧了我就是萌 提交于 2019-12-20 07:48:01
问题 I am using angular-openlayers-directive , I want to get coordinates of the point where I double click. A similar question: Convert point to lat lon But I want to use it in angularjs. 回答1: You should check this example out: http://tombatossals.github.io/angular-openlayers-directive/examples/080-events-propagation-example.html. It shows how you can find the lat-long coordinates for mouseover. Also, here is a fiddle I made showing how you can extend it for double click: http://jsfiddle.net

How to add shapefiles to a Bing Map using Openlayers 3

我是研究僧i 提交于 2019-12-20 06:12:18
问题 I am using Openlayers3 with Bing Maps to build my application. I have a point shapefile and would like to show it on the map. I could do it using Openlayers2 using the OpenLayers.Layer.GML() construct but am facing difficulty while trying to the same with Openlayers 3. I tried searching for this and the openlayer example gives me an error: 'Cannot read property 'ogc' of undefined'. My shapefile is on GeoServer in my own system. So any help regarding this matter is highly appreciated :) 回答1: