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