You are not logged in.

Announcement

*** NOTICE: forum.openstreetmap.org is being retired. Please request a category for your community in the new ones as soon as possible using this process, which will allow you to propose your community moderators.
Please create new topics on the new site at community.openstreetmap.org. We expect the migration of data will take a few weeks, you can follow its progress here.***

#1 2008-07-24 16:03:20

Barguast
Member
Registered: 2008-07-24
Posts: 4

Pixel-level long/lat calculations, and a database question!

One (hopefully) simple, one (probably) not!

1. I've read the page at http://wiki.openstreetmap.org/index.php … _tilenames to I can easily get the Tile X/Y coordinates for a given long/lat/zoom. However, how can I calculate the pixel-level X, Y position within that tile for the exact long/lat position?

For example, the tile at 51.4977798462, -0.173695996404 at level 5 is X=15, Y=10. But which pixel that tile best describes the given long / lat at the given zoom level?


2. I was hoping to load some of the map data into a database which the aim of creating a vector-based rendering engine. I know, it's a lot to hope for, but I don't suppose there are tools available that will import usable osm data into a database (I'll be wanting to use SQL Server, being Windows-based), including such information which will let me determine which geometry I need to draw (i.e. bounding boxes and min/max zoom levels).


Any help would be greatly appreciated. Thanks in advance. smile

Last edited by Barguast (2008-07-24 16:03:48)

Offline

#2 2008-07-25 14:43:00

the_winch
Member
Registered: 2008-02-24
Posts: 21

Re: Pixel-level long/lat calculations, and a database question!

For your second question take a look at how the mapnik layer is rendered.
http://wiki.openstreetmap.org/index.php/Mapnik
Osm data is imported into a PostGIS database using osm2pgsql. Perhaps osm2pgsql can be adapted to talk to SQL Server.

Offline

Board footer

Powered by FluxBB