[OpenLayers-Users] What is the layer name for mapnik?
Lukasz Szybalski
szybalski at gmail.com
Wed Oct 22 11:01:11 EDT 2008
On Wed, Oct 22, 2008 at 9:46 AM, Christopher Schmidt
<crschmidt at metacarta.com> wrote:
> On Wed, Oct 22, 2008 at 09:40:59AM -0500, Lukasz Szybalski wrote:
>> Hello,
>> Actually I found out that mapnik aka tile.openstreetmaps.org uses only TMS.
>
> OpenStreetMap uses 'flipped TMS', as described in
> http://trac.openlayers.org/wiki/UsingCustomTiles
ok. so openstreetmap uses flippedTMS instead of TMS? What is the difference?
>
>> Trying to run the TMS:
http://www.openlayers.org/dev/examples/tms.html
url of : http://tile.openstreetmap.org/
image: png
layer_name: .. (two dots)
This displays the maps but maps are not aligned correctly, I assume
this is somehow connected with flippedTMS vs TMS?
>
> Since OSM does not use TMS, but uses a custom getURL function, ther eis
> no layer name.
>
>>
>> var mapnik = new OpenLayers.Layer.TMS(
>> 82 "OpenStreetMap (Mapnik)",
>> 83 "http://tile.openstreetmap.org/",
>> 84 {
>> 85 type: 'png', getURL: osm_getTileURL,
>> 86 displayOutsideMaxExtent: true,
>> 87 attribution: '<a
>> href="http://www.openstreetmap.org/">OpenStreetMap</a>'
>> 88 }
>>
>>
>> Was anybody able to run this url with openstreetmaps TMS service?
>
> Yes. It's in the examples, after all.
It works....so from what you said my custom url function is (from example):
function osm_getTileURL(bounds) {
146 var res = this.map.getResolution();
147 var x = Math.round((bounds.left -
this.maxExtent.left) / (res * this.tileSize.w));
148 var y = Math.round((this.maxExtent.top - bounds.top)
/ (res * this.tileSize.h));
149 var z = this.map.getZoom();
150 var limit = Math.pow(2, z);
151
152 if (y < 0 || y >= limit) {
153 return OpenLayers.Util.getImagesLocation() + "404.png";
154 } else {
155 x = ((x % limit) + limit) % limit;
156 return this.url + z + "/" + x + "/" + y + "." + this.type;
157 }
158 }
So I guess question now is:
Can I configure mapnik to use proper TMS without custom geturl function?
or
Can I configure openlayers to use mapnik data. (I guess the answer
here is yes but only with custom geturl?)
I assume TMS is some kind of standard or?
Thanks,
Lucas
More information about the Users
mailing list