openlayers-3

how can i Restrict map to show only the selected country?

℡╲_俬逩灬. 提交于 2020-01-14 14:52:07
问题 I am trying to make web map application with openlayers 3. I have a problem which i want to fix. I am loading OSM layer as my base map of the application. But the problem with the OSM layer is that it shows whole world and I can pan my map all around the world. I want my application to be fixed in certain part. I have map extent set but still it doesn't work. I am using minZoom but it doesn't help. Is there any other way to fix this prolem? var centerpos = [84.2, 28.2]; var newpos = ol.proj

OpenLayers 3: per-layer translation for tiled image layers

偶尔善良 提交于 2020-01-07 05:38:08
问题 Sometimes it's useful to apply translation (that is, pixel offset) to a layer (and not other layers). For example, two line-based layers can be visually compared by translating (that is, offsetting) a layer. For vector layers, it can be done by translating vector features. But for the tiled image layers, (for example, road traffic information tiles generated by GeoServer) how can it be done? 回答1: This is also a nice example for precompose and postcompose render event handlers. precompose is

OpenLayers, Geoserver: TileWMS are displaying wrong

☆樱花仙子☆ 提交于 2020-01-07 04:08:05
问题 I'm trying to display some WMS with tiles, but at every zoom (in or out) the images are displaying wrong, with wrong proportions. This is how I'm creating the tile: var map = this.state.map; var layers = new ol.layer.Tile({ source: new ol.source.TileWMS({ url: 'http://XX.XX.XX:8080/geoserver/cite/wms', params: {'LAYERS': 'cite:clientes_ex', 'TILED': true, 'VERSION': '1.3.0', 'FORMAT': 'image/png8', 'WIDTH': 256, 'HEIGHT': 256, 'CRS': 'EPSG:3857'}, serverType: 'geoserver' }) }) map.addLayer

Return canvas (image) in openlayers 4

筅森魡賤 提交于 2020-01-07 03:56:12
问题 the example shows how to bind a button click event to the canvas and then it returns the image Example. How can I change it, that when I use a call openlayers with a permalink, that it automatically returns me that image? I would like to use a simple get request from an c++ programm to get the image. I have the e.g. "#map=12/1085115.28/6035092.46/0" as parsing parameters. Any ideas? Thanks and Greetings Melina So far I have the parameter parsing <!DOCTYPE html> <html> <head> <title

Is there any way to see when several placemarks superimposed on the same positions?

拥有回忆 提交于 2020-01-07 02:43:22
问题 Is there any way to see when several placemarks superimposed on the same positions? As the figure below, Google Earth, we have a way to see it. Thank you. 回答1: Yes, you can use your imagination and make a custom cluster. See this plunker demo, I use the following function to create a cluster like: var displayOverlapping = function(pixel) { var f = map.forEachFeatureAtPixel(pixel, function(ft, l) { return ft; }); if (f && f.get('type') == 'cluster') { if(f.get('expanded') === true) return; var

how do I create a transparent circle with adjustable radius on a map in openlayers 3

自古美人都是妖i 提交于 2020-01-06 11:05:59
问题 I am wanting to put a map with certain controls in a html document page, so that visitors can select a distance radius around their location. One of the controls I need is a semi transparent circle with a line from the centre to the edge. I want this circle to be adjustable using the mouse from the outer edge and keep its scale and position on the map when zooming or panning... I am using Django as my back end. I'd also like to know if I'd need to use javascript to accomplish this? I have

how do I create a transparent circle with adjustable radius on a map in openlayers 3

荒凉一梦 提交于 2020-01-06 11:05:12
问题 I am wanting to put a map with certain controls in a html document page, so that visitors can select a distance radius around their location. One of the controls I need is a semi transparent circle with a line from the centre to the edge. I want this circle to be adjustable using the mouse from the outer edge and keep its scale and position on the map when zooming or panning... I am using Django as my back end. I'd also like to know if I'd need to use javascript to accomplish this? I have

how do I create a transparent circle with adjustable radius on a map in openlayers 3

时间秒杀一切 提交于 2020-01-06 11:04:23
问题 I am wanting to put a map with certain controls in a html document page, so that visitors can select a distance radius around their location. One of the controls I need is a semi transparent circle with a line from the centre to the edge. I want this circle to be adjustable using the mouse from the outer edge and keep its scale and position on the map when zooming or panning... I am using Django as my back end. I'd also like to know if I'd need to use javascript to accomplish this? I have

Rotating polygon in OpenLayers 3

流过昼夜 提交于 2020-01-06 01:33:34
问题 I am new to OpenLayers 3 and I want to know how to rotate a polygon. I think if there is a way to do it it should be by using the applyTransform method (http://openlayers.org/en/v3.4.0/apidoc/ol.geom.Polygon.html#applyTransform) In order to try it, I made this: var points = [[1,0],[1,-6],[-1,-6],[-1,0],[1,0] ]; var polygon = new ol.geom.Polygon([points]); var rotateTransform = function (coords) { var renderArray=[]; for (var i = 0; i < coords.length; i++) { //rotation 45 degrees var rot = 45

OL3: extracting 'extended data' from KML

若如初见. 提交于 2020-01-05 19:29:43
问题 i have created a KML file with some custom attributes such as 'id' and 'room_id'. these attributes exist in the 'extended data' part of the KML file, here is the file: <?xml version="1.0" encoding="utf-8" ?> <kml xmlns="http://www.opengis.net/kml/2.2"> <Document id="root_doc"> <Schema name="map" id="map"> <SimpleField name="id" type="int"></SimpleField> <SimpleField name="room_id" type="string"></SimpleField> </Schema> <Folder><name>map</name> <Placemark> <name>room1</name> <Style><LineStyle>