<br>Hi,<br><br>Thanks for the help. It works now.<br><br>- Vishwa<br><br><div class="gmail_quote">On Fri, May 2, 2008 at 7:08 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;">
Hi<br>
<br>
Sorry I probably wasn't very clear in my previous email as I rushed it a<br>
bit, it was more intended to give you an idea how to work it out. I<br>
haven't loaded the tile in photoshop or anything but looking at your<br>
calculations and comparing them to a map tile, they do appear to have<br>
worked. The point on the tile that is at 142,11 pixels (from the top<br>
left) appears to be the point that you want to center on. How you center<br>
it will depend partly on how you're displaying, but perhaps moving the<br>
tile or the canvas as follows will do it:<br>
<br>
(256/2)-142=-14 pixels to the right (so 14 pixels to the left)<br>
(256/2)-11=117 pixels down<br>
<br>
As I say, depends how you're displaying things but I think that playing<br>
with these numbers should do the job.<br>
<br>
John<br>
<div><div></div><div class="Wj3C7c"><br>
On Fri, May 02, 2008 at 05:59:20PM +0530, Vishwa wrote:<br>
> 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<br>
> 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>
> On Wed, Apr 30, 2008 at 4:12 PM, root <<a href="mailto:john@mckerrell.net">john@mckerrell.net</a>> wrote:<br>
><br>
> > 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>
> ><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<br>
> > 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<br>
> > 3x3<br>
> > > grid. how to center align the map when the center can be anywhere within<br>
> > the<br>
> > > 256x256 center tile?<br>
> > ><br>
> > > thanks<br>
> > > vishwa<br>
> > ><br>
> > ><br>
> > > > 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>
> > > > > > In other words, how to know the pixel (x,y) *within the center<br>
> > 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>
> > > > > Iv??n S??nchez Ortega <<a href="mailto:ivan@sanchezortega.es">ivan@sanchezortega.es</a>><br>
> > > > ><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>
> > > _______________________________________________<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>
> ><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>
<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>
</div></div></blockquote></div><br>