Creating code, mostly for the fun of seeing it work.


OSMPosted by Chris Thu, October 02, 2008 21:12:56
I checked out how to do some simple tile handling for OSM. The map can be displayed using OpenLayers. This JavaScript stuff uses AJAX to get and display tiles that can be dragged around, zoomed in or zoomed out. The basis of the map are the tiles. They are 256px square. Each zoom level is twice the linear detail of the previous one, so a tile at zoom level 12 expands to 4 tiles (2x2) on zoom 13. All of this fits over a world mapped with longitude and latitude.

So one useful idea is that for any given tile, what is the long & lat of the edges of the tile. I was working on this when I tripped over the code on the OSM wiki, in any (code) language you want, so I copied it into a simple class and it worked well.

  • Comments(0)

Fill in only if you are not real

The following XHTML tags are allowed: <b>, <br/>, <em>, <i>, <strong>, <u>. CSS styles and Javascript are not permitted.