openlayers-3

Proj4Leaflet reprojection like in openlayers

孤者浪人 提交于 2020-01-03 19:06:17
问题 I try to display several layers in own projections on base map also in it's own projection Below my working example implemented using OpenLayers + proj4 library var projection_name = 'EPSG:32610'; proj4.defs(projection_name, "+proj=utm +zone=10 +datum=WGS84 +units=m +no_defs"); var proj = ol.proj.get(projection_name); var my_custom_layer = new ol.layer.Tile({ opacity: 0.5, source: new ol.source.XYZ({ url: '', projection: proj, }) }); var osm_layer = new ol.layer.Tile({ source: new ol.source

How to make ol.source.ImageWMS send POST request

天大地大妈咪最大 提交于 2020-01-03 16:57:01
问题 In our project, we're using OpenLayers-3's ol.source.ImageWMS to show image provided by Mapserver WMS. Since we're using Mapserver runtime substitution, our request can become quite long, wich could cause a problem for a GET request. Is there a way to make ol.source.ImageWMS send POST request? 回答1: I answer this just for the reference based on this Openlayers dev thread, hopefully it will help someone in the future!. I needed to pass a very long CQL request to a Geoserver wms, and GET was

OL3: Zoom to vector layer on map

爷,独闯天下 提交于 2020-01-03 13:31:30
问题 I have a map with openlayers 3 and a vector layer. I want to map to be resized to this vector layer, but so far all I was able to get was to center the map on the last point of this vector, since the points of the vector layer are not accessible while creating the map: if (trackMap != null) { for (var i = 0; i < trackMap.length; i++) { var trackInfo = trackMap[i]; lat = parseFloat(trackInfo.lat); lon = parseFloat(trackInfo.lon); var layergpx = new ol.layer.Vector({ source: new ol.source

Vector tiles buffer

陌路散爱 提交于 2020-01-02 07:25:13
问题 I have issue setting up an Openlayers map with vector tiles served from Geoserver. The lines gets screwed up along the edges of the tiles. It looks like the lines are first clipped and then styled instead of the opposite. This makes wide lines look ugly. Changing the renderBuffer in the OL client doesnt make any difference. I have similar issues with labels and perhaps the solution is pretty much the same in both cases. EDIT: The geojson in QGIS shows that there is a buffer around the tiles:

Drawing a Speed Leader line in OpenLayers

南笙酒味 提交于 2019-12-31 01:39:07
问题 I'm trying to draw an icon representing a entity on an OpenLayers map that includes a "speed leader", which is a small line segment that originates at the icon and draws outward in the direction the entity is moving. The length of the line indicates the speed of entity. The problem I'm running into is that I want the length of the line to be relative to screen coordinates, but the angle and position of the line to be relative to map coordinates. Thus, when zooming in, I would not expect the

ZoomToExtent OpenLayers 3

流过昼夜 提交于 2019-12-30 03:44:09
问题 OpenLayers 2 had a very useful map.zoomToExtent(extent) feature. Is there something similar in OpenLayers 3? I can get the extent of interest with source.getExtent() , but I can't figure out how to apply that extent as a "zoom level". 回答1: Going off the function sfletche linked to: var extent = source.getExtent(); map.getView().fitExtent(extent, map.getSize()); EDIT July 23, 2013 Apparently fitExtent is deprecated. Should be ol.View.fit , so something linke this (untestesd): var extent =

how to add markers with OpenLayers 3

五迷三道 提交于 2019-12-28 04:51:47
问题 I'm trying to add makers on a OpenLayers 3 map. The only example I have found is this one in the OpenLayers example list. But the example uses ol.Style.Icon instead of something like OpenLayers.Marker in OpenLayers 2 . First Question The only difference would be that you have to set the image Url but is it the only way to add a marker? Also OpenLayers 3 doesn't seem to come with marker images so it would make sense if there's no other way than ol.Style.Icon Second Question It would be really

why doesn't show feature on map

断了今生、忘了曾经 提交于 2019-12-25 19:50:10
问题 this is fiddle Link.Feature doesn't show on map when it has been like this code : var featureVectorLayer = new ol.layer.Vector({ source: featureClusterSource, style: new ol.style.Style({ fill: new ol.style.Fill({ color: 'rgba(255, 255, 255, 0.2)' }), stroke: new ol.style.Stroke({ color: 'blue', width: 2 }), image: new ol.style.Circle({ radius: 7, fill: new ol.style.Fill({ color: '#ffcc33' }) }) }) }); But i change source - featureClusterSource to featureVectorSource.it works well but in this

Uncaught TypeError: Cannot read property 'Input' of undefined

纵然是瞬间 提交于 2019-12-25 18:35:14
问题 I changed from OpenLayers v3.0.0 to 3.19.1 and now following line doesn't work: var visible = new ol.dom.Input(document.getElementById('visible')); Switching back to the older version, everything is ok. What's going wrong? 回答1: ol.dom.Input was removed in 3.5.0 The experimental ol.dom.Input component has been removed. If you need to synchronize the state of a dom Input element with an ol.Object, this can be accomplished using listeners for change events. For example, you might bind the state

Geofencing feature - Place Map points ,polygon ,Identify point within polygon

寵の児 提交于 2019-12-25 10:16:42
问题 I have two queries regarding Polygon in Open Layers. 1)How can we place some array of points on the OS map? 2)Suppose we want to draw a polygon. How could we know whether the points are inside of the polygon or not. In short if we draw a polygon, we fetch the boundaries: How can we identify whether the points are inside the polygon or not? Any help would be appreciated as I am a beginner. 回答1: Welcome to the OpenLayers community! 1) See this example to learn how to add point(s) to a map: http