[OSM-newbies] Converting lat/lon to pixel within a tile
Vishwa
rnvishwa at gmail.com
Fri May 2 13:29:20 BST 2008
Sorry, it still not working.
Here are my values:
lon = -0.127144
lat = 51.506324999991364
zoom = 12
>From which i calculate:
xtile = 2046
ytile = 1362
Also, as you suggested i tried to take the decimal part and determine how
much the tiles have to be moved:
X
2046.5533838222223
0.5533838222223 X 256 = 141.6 = 142 pixels
Y
1362.0441915021011
0.044191502101057267 * 256 = 11.31 = 11pixels
Is this calculation is according to what you have suggested?
The end result is not centering the map.
Regards,
Vishwa
On Wed, Apr 30, 2008 at 4:12 PM, root <john at mckerrell.net> wrote:
> If you convert the lat/lon to a floating point tile coordinate you can
> then use the decimal part to tell you how much you need to shift the
> tiles. Multiply it by 256 and that'll tell you how far. That help?
>
> On Wed, Apr 30, 2008 at 03:55:55PM +0530, Vishwa wrote:
> > i am doing this using C#.Net to create a image out of tiles, and i have
> to
> > center the image to the given image
> >
> > i know the zoom level, and the center coordianates, and the size of the
> 3x3
> > grid. how to center align the map when the center can be anywhere within
> the
> > 256x256 center tile?
> >
> > thanks
> > vishwa
> >
> >
> > > On Wed, Apr 30, 2008 at 1:15 PM, Iv??n S??nchez Ortega <
> > > ivan at sanchezortega.es> wrote:
> > >
> > > > El Mi??rcoles, 30 de Abril de 2008, Vishwa escribi??:
> > > > > In other words, how to know the pixel (x,y) *within the center
> tile*
> > > > for a
> > > > > given lon,lat value.
> > > >
> > > > If you're using javascript, please keep in mind that there are
> > > > OpenLayers
> > > > functions for this.
> > > >
> > > > --
> > > > ----------------------------------
> > > > Iv??n S??nchez Ortega <ivan at sanchezortega.es>
> > > >
> > > > "Anything that is too stupid to be spoken is sung."
> > > > - Voltaire (1694-1778) [poor guy, never knew about rap]
> > > >
> > >
> > >
>
> > _______________________________________________
> > newbies mailing list
> > newbies at openstreetmap.org
> > http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/newbies
>
>
> _______________________________________________
> newbies mailing list
> newbies at openstreetmap.org
> http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/newbies
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/newbies/attachments/20080502/4f7b3469/attachment.html>
More information about the newbies
mailing list