openlayers-3

openlayers 3 : draw arrow on multi line

南楼画角 提交于 2019-12-25 09:18:11
问题 I'd like to know if it's possible to draw an arrow icon on a MultiLineString My aim is to show multiline with an arrow on every line of the multiLine. I have seen some examples on the web, but those are always with a single line. Do you know if it's possible to do it with a multiLineString? 回答1: Yes, it is possible. var styleFunction = function(feature) { var geometry = feature.getGeometry(); var styles = [ // linestring new ol.style.Style({ stroke: new ol.style.Stroke({ color: '#ffcc33',

Angular2 + Openlayers3: Test fails when map renders. Writing tests impossible?

痞子三分冷 提交于 2019-12-25 08:24:04
问题 I have create an Angular2 app (+Webpack). I added a component which shows an Openlayers3 map.It also adds a few markers and a polygon. I am reasonable happy with the functionality, but writing a test for it nearly proves impossible. This is the test source code: ( I have not added any expect statements yet. The test seems to break when Openlayers tries to render the map. /* tslint:disable:no-unused-variable */ import {async, ComponentFixture, TestBed} from '@angular/core/testing'; import

turf.js Intersect Error for Self-intersecting Polygons from OpenLayers3 Draw

我是研究僧i 提交于 2019-12-25 08:01:05
问题 I am using OpenLayers3 ol.interaction.Draw to let the user draw a shape on the map, either by clicking vertices or by Shift+Drag to draw a freeform polygon (this is important to my application). Once a shape is drawn, I use turf.js to compare the drawn shape to a WFS layer in the client, running intersect() to see if the WFS features intersect the drawn shape. However, if the hand drawn shape has even the slightest self-intersection, the turf.js intersect() function fails with the following

How can i create static marker in OpenLayers 3?

耗尽温柔 提交于 2019-12-25 02:48:07
问题 I don't have a great level in javascript and OpenLayers, and i am trying to realize a map with static markers pointing airports in all the world. Well i tried to search my answer but i can't resolve my problem. I already tried to find docs or examples, but every time it doesn't work. Please if anybody can help me by telling me how to create markers based on a list of data? Thank you a lot. 回答1: (fiddle) var vectorLayer = new ol.layer.Vector({ source: new ol.source.Vector({ format: new ol

OpenLayers 3 not showing on a simple modal

自闭症网瘾萝莉.ら 提交于 2019-12-25 01:32:36
问题 I'm trying to display a map using OpenLayers 3 and the SimpleModal plugin for jQuery. When I click my link, the modal opens but the map isn't showing. What am I missing? I've reproduced my problem on JSBin, http://jsbin.com/hunexepeti/2/edit?html,js,output This is the HTML relevant part, <a id="open-map" href="#">Open map</a> <div id="map"></div> and this is my JS, function initMap(lat, lon) { var container = document.getElementById('map'); var map = new ol.Map({ layers: [ new ol.layer.Tile({

Connect off canvas menu with markers

泄露秘密 提交于 2019-12-24 13:54:57
问题 I'm working on a mapping project and I need to mark some building to display some data for that specific building. Basically, literally I'm trying to build something like this I have found off canvas project and I'm using it for mine map, here is a working JSFIDDLE example. For the map I'm using openlayers3 , openstreetmap , I'm not using google-maps and I'm not interesting in using it, I'm just referencing on this picture because they have a nice example of this off canvas display data menu.

Creating an event on a map maker

孤街浪徒 提交于 2019-12-24 08:22:28
问题 //Final Code var map = new ol.Map({ target: 'map', layers: [ new ol.layer.Tile({ source: new ol.source.OSM() }) ], view: new ol.View({ center: [0, 0], zoom: 3 }) }); // -- GeoJSON layer -- // Define a GeoJSON source that will load features via a http call. By // specifying the projection of the map's view OL3 will transform the coordinates // for display var planningAppsSource = new ol.source.GeoJSON({ 'projection': map.getView().getProjection(), 'url': 'http://localhost/osgis-ol3-leaflet

OpenLayers 3: Zoom map to coordinates in array

三世轮回 提交于 2019-12-24 07:50:11
问题 I need to zoom my OpenLayers map (which uses a Google Maps baselayer) to fit all of a given list of coordinates into the view. I've stored the coordinates in an array of longitude and latitude pairs named pointsDecimal which looks like this: pointsDecimal: Array[50] 0: 148.77638 1: -34.491728 2: 148.77896 3: -34.492302 4: 148.778090711323 ... Even-numbered indices (0, 2, 4 etc) are longitude, and odd-numbered indices (1, 3, 5 etc) are latitude. This is the code I'm trying to use: map.getView(

Rotating marker (icon) in openlayers 3

早过忘川 提交于 2019-12-24 07:00:07
问题 I m using openlayers 3 in my project. I created a custom marker (icon) and i need to rotate marker with angle. Is anybody tried this before? It is a critical part of my code and i couldnt figure it out. Note: Not the map. just marker. 回答1: Set up an overlay like in the icon example and apply CSS rotation to it (ie. transform: rotate(120deg); , add browser prefixed versions as needed). If you need this to be dynamic, adjust the property through JavaScript. 回答2: In current versions of

Is it possible to add a icon symbol to a polygon

本小妞迷上赌 提交于 2019-12-24 05:28:09
问题 I am currently working on a openlayers 3 project and for better visulaizing i need to show both. The Polygon shape(attribute based color) which works great and an icon on the polygon position. I know that the polygon contains multiple coordinates and so its not so easy to define a position for the icon. Now i have some kind of workaround that creates an seperate overlay with the interior Points of the polygon to mark the position of the icons. To make the project more simple i want to combine