I need the bounds/full extent of a WMS layer in Leaflet. I don't think L.TileLayer.WMS has a getBounds() method. I had this issue with L.ImageOverlay, and added the functionality via:  L.ImageOverlay.include({     getBounds: function () {         return this._bounds;     } });   Is there a solution for L.TileLayer.WMS? Or will I have to start parsing the WMS getCapabilities request for its LatLongBoundingBox or BoundingBox elements?  EDIT  I've just found a duplicate: . This question is still relevant, since Leaflet 1.0 has since been released.  EDIT 2   does not answer my question - its answer is to parse the getCapabilities response manually. Is there any other way?
121562
Is it possible to request the bounding box of a WMS from GeoServer?  In my case I have a WMS that I show with L.TileLayer.WMS in a Leaflet map. I like to center and zoom my map to the WMS.
23355
Is it possible to enable  (CORS) in OpenLayers?  If so, how?  I have a web map in OpenLayers, and I'm using an HTML canvas to render it as a PNG image.  My script works great, but due to the browser's , I can only convert my canvas to an image if all the map tiles I've drawn to it come from the same host (e.g. sub.domain.com).  To boost my map's loading speed, I pull tiles from an array of subdomains: a.domain.com, b.domain.com, etc.  This greatly improves performance, working around the browser's limit of four simultaneous connections per host, but prevents me from ever converting my canvas to an image, as the tiles come from multiple hosts.  I'm trying to use  to work around this problem.  I've set the appropriate Access-Control-Allow-Origin response header for the tileset I serve with PHP, but this doesn't have an effect.  I suspect this is due to not having the Origin header in the request (as shown in the example on the Wiki page).  It would seem that some OpenLayers configuration is required.  But what?  Has anyone else done this successfully?
85126
I'm looking for tool that will be convert  WMS to vector layer.  Are they ready tool?(for example in python)
31438
Can anyone please help me to understand the below code. I am not able to understand how we are  extracting value from map on visualforce page.  Actually i am trying to get the size of value list which is associated with respective key in map.              &lt;apex:outputPanel &gt;                 &lt;apex:repeat value="{!attributeWrapper.mapAllAttributesLabel}" var="M"&gt;                     &lt;div&gt;                         &lt;div&gt;{!attributeWrapper.mapLabels[M].Name} &lt;/div&gt;                         &lt;div&gt;                             &lt;ul&gt;                                 &lt;apex:repeat value="{!attributeWrapper.mapAllAttributesLabel[M]}" var="attribute"&gt;                                     &lt;li&gt;                                     &lt;p&gt;                                         &lt;apex:outputLink onclick="selectAttribute('{!attribute.attributeLabel.Label__c}','{!attribute.attributeLabel.Attribute__c}');return false;"&gt;                                            &lt;apex:outputLabel value="{!attribute.attributeLabel.Attribute__r.Name}"/&gt;                                         &lt;/apex:outputLink&gt;                                     &lt;/p&gt;                                     &lt;/li&gt;                                 &lt;/apex:repeat&gt;                             &lt;/ul&gt;                         &lt;/div&gt;                     &lt;/div&gt;                 &lt;/apex:repeat&gt;             &lt;/apex:outputPanel&gt;    public with sharing class AttributeWrapper {      public Map&lt;String, List&lt;AttributesLabelWrapper&gt;&gt; mapAllAttributesLabel{       // some code to populate this map     } }   If i do:  {!attributeWrapper.mapAllAttributesLabel[M].size}   I get an error so how do i get the size of value list on VF page?
120003
I have a question about Openlayers3 , I have the below code that initializes my map on my small demo application:  var map = new ol.Map({     layers: [         new ol.layer.Tile({             source: new ol.source.OSM()         })     ],     target: 'map',     controls: ol.control.defaults({         attributionOptions: /** @type {olx.control.AttributionOptions} */ ({             collapsible: false         })     }),     view: view });    You can see a demo   Now my question is how do I get the Tile url , so that I can store it locally using localstorage ? how do I get the Tile url ?   I saw the  , but I am not sure how to use it ? can anybody help me understand how to get the tile url ? (can can play around in the Chrome Developer Tools for the demo that I have provided.)
61748
I am trying to find the shapefiles for postcode sector and districts in the UK. Specifically inside London. I know I can go and pay for these but I only really need to use them once. I want to generate my own mapping tiles with the shapes on one version of the tiles. Allowing me to show all the postcode boundaries without overloading the JavaScript on the client side.   I could "redraw" some of shapes myself (tracing from others) but would be great if there were some shapefiles already out there.   Can anyone help?
77698
Given staggered isometric map and a start tile what would be the best way to get all surrounding tiles within given radius(middle to middle)?   I can get all neighbours of a given tile and distance between each of them without any problems but I'm not sure what path to take after that. This feature will be used quite often (along with A*) so I'd like to avoid unecessary calculations.  If it makes any difference I'm using XNA and each tile is 64x32 pixels.
112762
This is my simple GeoJSON with Leaflet map.  I want to display properties as popup but I don't know why it is empty.   Can you tell me my mistake?  &lt;html&gt; &lt;head&gt; &lt;title&gt;A Leaflet map!&lt;/title&gt; &lt;link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" /&gt; &lt;style&gt; #map { width: 960px; height: 500px; } &lt;/style&gt; &lt;/head&gt;  &lt;body&gt; &lt;div id="map"&gt;&lt;/div&gt; &lt;script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"&gt;&lt;/script&gt; &lt;script&gt;     var map = L.map('map',{     center: [49.833352, 18.163662],     zoom: 10     });     L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {     attribution: '&amp;copy; &lt;a href="http://osm.org/copyright"&gt;OpenStreetMap&lt;/a&gt; contributors'     }).addTo(map);      var data ={       "type": "FeatureCollection",       "features": [         {           "type": "Feature",           "geometry": {             "type": "Point",             "coordinates": [               23.4850463378073,               46.7440954850672             ]           },           "properties": {             "f1": 11793,             "f2": "BT"           }         }       ]     };  var layer = L.geoJson(data, { }).addTo(map); layer.bindPopup('&lt;h1&gt;'+feature.properties.f1+'&lt;/h1&gt;&lt;p&gt;name: '+feature.properties.f2+'&lt;/p&gt;'); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt;
65820
Problem I have: map tiles from my layer are being repeated.  Shapefile is projection 3059. I have specified 3059 is in the mapfile and also when creating map object.  I know OpenLayers.Layer.WMS is recommended, but when I use it I only see empty map. When I use OpenLayers.Layer.MapServer, map is displayed (and tiles are repeated), so I'm using that for now.  My layer (EPSG:3059) looks like this    Versions: Openlayers 2.13.1 MapServer 6.0.3  WMS Server mapfile:  MAP     NAME country_map     STATUS ON     SIZE 800 500     EXTENT 313187.4 146161.56 766469.92 470367.64     UNITS METERS     SHAPEPATH "shapefiles"     IMAGECOLOR 155 155 155      WEB         TEMPLATE "template.html"         IMAGEPATH "C:/MS4W/ms4w/apache/htdocs/gis/output/"         IMAGEURL "/gis/output/"          METADATA             "wms_title"             "MapServer + Openlayers"             "wms_onlineresource"    "http://localhost:1025/cgi-bin/mapserv.exe?map=C:\MS4W\ms4w\Apache\htdocs\gis\mapfile2.map"             "wms_enable_request"    "*"             "wms_srs"               "EPSG:3059"         END     END      PROJECTION         "init=epsg:3059"     END  # example layer     LAYER     METADATA         "wms_title"             "lat_rob_region"     END     NAME "lat_rob_region"     DATA lat_rob_region     STATUS ON     TYPE POLYGON         CLASS             NAME "lat_rob_region"             STYLE                 COLOR 0 255 0             END         END     END END   Javascript:  var lon = 25; var lat = 57; var zoom = 5; var map, layer1;  function init() {     map = new OpenLayers.Map( 'map',{displayProjection: new OpenLayers.Projection("EPSG:3059")} );      layer1 = new OpenLayers.Layer.MapServer( "Country map",              "http://localhost:1025/cgi-bin/mapserv.exe?map=C:/MS4W/ms4w/Apache/htdocs/gis/mapfile2.map", {layers: 'lat_rob_region'},             {gutter: 15},{srs: 'EPSG:3059'});     map.addLayer(layer1);      map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);     map.addControl( new OpenLayers.Control.LayerSwitcher() ); }
102242
I want to display popup with the data item, such as: name, coordinates, stationID, Attribute.  But my code has some problem that can't run.  &lt;html lang="en-US" xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head profile="http://gmpg.org/xfn/11"&gt;     &lt;link rel="stylesheet" href="https://unpkg.com/leaflet@1.5.1/dist/leaflet.css"           integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ=="           crossorigin="" /&gt;     &lt;script src="https://unpkg.com/leaflet@1.5.1/dist/leaflet.js"             integrity="sha512-GffPMF3RvMeYyc1LWMHtK8EbPv0iNZ8/oTtHPx9/cc2ILxQ+u905qIwdpULaqDkyBKgOaB57QTMg7ztg8Jm2Og=="             crossorigin=""&gt;&lt;/script&gt;     &lt;script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"&gt;&lt;/script&gt;     &lt;script src="https://code.jquery.com/jquery-2.1.1.min.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt;     &lt;div id="map" style="height: 500px; border: 1px solid #AAA;"&gt;&lt;/div&gt;     &lt;script&gt;          var osmUrl = 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',             osmAttrib = '&amp;copy; &lt;a href="https://www.openstreetmap.org/copyright"&gt;OpenStreetMap&lt;/a&gt; contributors',             osm = L.tileLayer(osmUrl, { maxZoom: 20, attribution: osmAttrib });         var map = L.map('map').setView([24.151687694799833,120.64116954803465               ], 15).addLayer(osm);              //顯示地圖         L.control.scale().addTo(map);          $.getJSON("https://sta.ci.taiwan.gov.tw/STA_Rain/v1.0/Things?$expand=Locations&amp;$select=name,properties&amp;$count=true", function (data) {             var markerGroup = L.featureGroup();             data.value.forEach(function (itemData, itemInd) {                 var latLng = L.latLng(itemData.Locations[0].location.coordinates[1], itemData.Locations[0].location.coordinates[0]);                 var myMarker = L.marker(latLng).addTo(markerGroup);                 myMarker.bindPopup('ID: ' + itemData.properties.stationID + '&lt;br /&gt;Name: ' + itemData.properties.stationName);                    onEachFeature (itemData, layer) {                     layer.bindPopup("&lt;p&gt;&lt;/p&gt;"                         + itemData.name + "&lt;/p&gt;"                         + itemData.properties.Attribute +                         "&lt;/p&gt;Attribute: "                     );                 };             }).addTo(map);              markerGroup.addTo(map);             map.fitBounds(markerGroup.getBounds());                   });     &lt;/script&gt; &lt;/body&gt; &lt;/html&gt;   This is my GeoJSON:  https://sta.ci.taiwan.gov.tw/STA_Rain/v1.0/Things?$expand=Locations&amp;$select=name,properties&amp;$count=true
97190
My app takes several seconds to return all features of a WFS layer from server, I am wondering whether there is a way to check whether all features are returned in coding, so that we can add a loading-mask...  In other words, how do you check whether a WFS request is successful or not?  Code sample:  var newEventLayer = new OpenLayers.Layer.Vector (     'test'     , { "strategies":             [new OpenLayers.Strategy.BBOX()             , new OpenLayers.Strategy.Refresh({ "force": true })             ]         , "protocol": new OpenLayers.Protocol.WFS(         {   "version": '1.0.0'             , "srsName": 'EPSG:4326'             , "url": '/geoserver/ows?service=WFS'             , "featureType": 'XXX'             , "featureNS": 'XXXX'             , "geometryName": 'GEOM'         })     } );  map.addLayer(newEventLayer);
113280
I have layer (ImageWMS that has GeoTIFF format) and also OSM or another for my baselayer. According to  I should get pixel[0] and pixel[1] and pixel[2] to calculate height . But I have an image layer and when clicked on image layer I received pixel values of base layer not image layer. So I added filter to my codes for showing just image layer's pixel value but console show me (NON). How can I find the pixel value of image layer or better way for calculate height from image layer (raster layer .tiff)? Here is my code : const UnTiled = new ol.layer.Image({         opacity:0.9,         title:'UnTiled',         source: new ol.source.ImageWMS({             ratio: 1,             url: 'http://localhost:8080/geoserver/world/wms',             params: {                      'VERSION': '1.1.1',                     &quot;STYLES&quot;: '',                   &quot;LAYERS&quot;: 'world:world',                   &quot;exceptions&quot;: 'application/vnd.ogc.se_inimage',             }                    })                    });map.addLayer(UnTiled);  map.on('singleclick', function(evt) { map.forEachLayerAtPixel(     evt.pixel,     function (layer, pixel) {       var height =         -10000 + (pixel[0] * 256 * 256 + pixel[1] * 256 + pixel[2]) * 0.1;         console.log(height)     },     {       layerFilter: function (layer) {         return layer === UnTiled;       },     }   ); })
53987
I need to filter an OpenLayers layer using a CQL filter to an specific Bounding Box. Is it possible?  Something like this isn't working:  igh &gt; 5000 AND bbox(igh,20786691,22051867,-305577260,-306370356)
68036
Problem  The picture is just an example of my case, but I am left with blank space on the left when I load all the tiles and I get error message in the console:   Failed to load resource: the server responded with a status of 404 (Not Found) http://path/to/the/tile//base/8/6/53.png  etc.     I could guess and limit the extent of the layer, but I would really like to know is there any way to calculate it and also be able to get rid of the error message.  What I know about the tiles?   Originally they are served as TMS They represent png images 256*256 They are in projection: EPSG:3857 In OpenLayers2 they were called like TMS layer In OpenLayers3 (v.3.8.2) they are called like XYZ layer (that includes -y):     var baseLayer = new ol.layer.Tile({   source: new ol.source.XYZ({     url: 'http://path/to/the/tiles/base/{z}/{x}/{-y}.png'   }) });   Thoughts and questions   How can I calculate extent of the tiles? Or in another words how can I find out zmin zmax xmin ymin xmax ymax or whole range of x/y?  What does x/y really represent? Are they coordinates of the left bottom corner or center of the tile? In which direction does x/y increase? How can I figure out x/y of at least one of the tile, for example left bottom one?    (I have modified the question for better understanding of the problem)
112978
I have a WFS layer:  myVecLayer_disp= new OpenLayers.Layer.Vector("Редактируемый участок",{projection: new OpenLayers.Projection("EPSG:900913")});   And i have feature store:          var protocol=new OpenLayers.Protocol.HTTP({             url: url_servlet+"fullSearch.jsp",             format: new OpenLayers.Format.GeoJSON({internalProjection: new OpenLayers.Projection("EPSG:4326"),externalProjection:new OpenLayers.Projection("EPSG:900913")})     });     searchStore = new GeoExt.data.FeatureStore({         layer: myVecLayer_disp,         fields: [             {name: 'id', type: 'String'},             {name: 'name_dispatcher', type: 'String'},             {name: 'voltage', type: 'String'},         ],         proxy: new GeoExt.data.ProtocolProxy({             protocol: protocol,         }),         autoLoad: true,         layerOptions: function() {             return {                 strategies: [new OpenLayers.Strategy.BBOX()],                 //projection:"EPSG:4326"             };         }     });   As you see i use GeoJSON. In this geojson i have features in wgs84. And reproject it in mercator in protocol. Now i show this layer:      app.mapPanel.map.addLayers(myVecLayer_disp); myVecLayer_disp.visibility=true;   And see features near Africa but expect to see it within Russia. So Nothig reproject i think. But when i see layes's features:      LINESTRING(0.00055807640304122 0.00050642147755534,0.00055807616948463  0.00050641930362077,0.00055807588202664 0.00050641664462617,0.00055807423809849  0.00050641332981391,0.00055807306129967 0.00050640979946183,0.00055807191147579  0.00050640644872202,0.00055807052802261 0.00050640231648177,0.00055806910873212  0.00050639813934481,0.00055806841697321 0.00050639609116937,0.00055806763547558  0.00050639388128181)   Ant this is same feature in geojson:  {"type":"LineString","coordinates":[[62.124781001642077,56.374581001212391], [62.124755002241727,56.374338999945053],[62.124723002564679,56.374043002482722], [62.124540001320156,56.373673997157425],[62.12440900067503,56.373281000617851], [62.124281002866155,56.37290799870533],[62.124126997563053,56.372447999975407], [62.123969002867341,56.371983002813522],[62.123891996618511,56.371755002191776], [62.123805000700372,56.371508997142655]]}   What i doing wrong?
52050
I am trying to incorporate a wms feed in the British national grid projection (EPSG:27700) into a openlayers 3 project. I initially had used this wms layer in an openlayers 2 application using the following syntax:  new OpenLayers.Layer.WMS(         "ukimage",         "http://www.linktowms",         {             "LAYERS": 'ukimage',             "STYLES": '',             format: state.image_format         }, {     buffer: 0,     displayOutsideMaxExtent: true,     isBaseLayer: true } );   But I am having trouble converting this over to openlayers 3. I first tried setting the map projection to British national grid (view: new ol.View({ projection: 'EPSG:27700'}) as I had in the openlayers 2 app, but this produced the error  TypeError: h.B is not a function    and a white map.   When I try and use proj4 to convert the projection to EPSG:3857 as described here:  I get the same error:   TypeError: h.B is not a function    and again a white map.   my wms request is generally a varient of:  new ol.layer.Image({       source: new ol.source.TileWMS({         url: 'http://www.linktowms',         params: {'LAYERS': 'ukimage'},       })     }),   (I tried adding projection but that didn't help)  I am trying to work out if the image is even getting loaded from the WMS feed, but the syntax seems to have changed significantly from openlayers 2, instead of the properties and functions that have rather descriptive names, there are a now lots of short functions with names like Ua and Ig, which leaves me a bit in the dark as to what's actually going on when I try and inspect the layer with firebug.  I don't mind what projection the application is in, as I can re-project my other layers to match the basemap, so basically any way of using this EPSG 27700 WMS layer in openlayers 3 would be great.
37223
Looking at this information page for a dataset hosted on esri.com:   Trying to figure out how I can get access to the raw data (either raw lat/lng coordinates or SHP).  It looks like the data is available, I just can't figure out how to pull it from this interface.