Thanks Arnd.. thanks for your answer .. it works.. Francesco
>----Messaggio originale---- >Da: [email protected] >Data: 17/04/2012 22.42 >A: <[email protected]> >Cc: <[email protected]> >Ogg: AW: [OpenLayers-Users] Get tiles from bounds > >Something like this should return the tiles url (OSM) for a given location: > >function getURLforLocation(ll, z) >{ > var lyrOSM = map.layers[1]; > var maxExtent = lyrOSM.maxExtent; > var tileSize = lyrOSM.tileSize; > var resArr = lyrOSM.resolutions; > > var x = Math.floor((ll.lon - maxExtent.left) / (resArr[z] * >tileSize.w)); > var y = Math.floor((maxExtent.top - ll.lat) / (resArr[z] * tileSize.h)); > > var url = "http://tile.openstreetmap.org/${z}/${x}/${y}.png"; > var path = OpenLayers.String.format(url, {x: x, y: y, z: z}); > return path; >} > >var Msg = ""; >var NL = "\n"; > >//Freiheitsstatue >var ll = new OpenLayers.LonLat(-74.0445225093636,40.68924187031257); >var xy = ll.transform(new OpenLayers.Projection("EPSG:4326"), new >OpenLayers.Projection("EPSG:900913")); > >var tilesUrl = ""; >for(var i=0;i<19;i++) > tilesUrl += getURLforLocation(xy, i) + "\n"; > >console.log(tilesUrl); > >Arnd > > > >-----Ursprüngliche Nachricht----- >Von: [email protected] >[mailto:[email protected]] Im Auftrag von >[email protected] >Gesendet: Montag, 16. April 2012 22:22 >An: [email protected] >Betreff: [OpenLayers-Users] Get tiles from bounds > >Hi all, >i have a question about how to get all tiles url from getURL(bounds) from >different zoom level. >I explain my purpose: I use an OSM layer and i like to know what is the tile >from different zoom level that cover the center of the map. > >mytiles = new OpenLayers.Layer.OSM () > >mytiles.getURL(bounds) i get http://localhost/tiles/10/1/1000.png for >example. >(zoom level 10) > >How is possible to get the tiles URL for example of zoom 9 or zoom 11? > >Thanks > >Francesco > > > >_______________________________________________ >Users mailing list >[email protected] >http://lists.osgeo.org/mailman/listinfo/openlayers-users > > _______________________________________________ Users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/openlayers-users
