John and Neil,

I have another question and hope you guys can enlight me a little.
Because I am going to cover the whole united states. I have to use
many big images(5120 X 5120). How do I connect 2 lat/lon pairs that on
different images? Any one of you have the function already done that?

Thanks
Qin




On Mar 12, 9:44 pm, zoogle <[email protected]> wrote:
> Thanks Neil!
>
> On Mar 11, 4:21 pm, "neil.young" <[email protected]> wrote:
>
>
>
> > See below. Use:
>
> > TileCoordinate c = new TileCoordinate(lat, lon, zoom);
> > if (c.locationCoord()) {
> >     // Do whatever
>
> > }      
>
> > whereas lat, lon is the geocoordinate (e.g. 52.123, 13.123) and zoom is
> > the Google zoom stage (0...17). The resulting x,y is the image
> > coordinate within the big, fat picture, Google draws for us. The int
> > part may be used directly to obtain the tiles (Attention: Illegal) using
> > a URL formed like this:
>
> > String.Format("http://mt.google.com/mt?x={0}&y={1}&zoom={2}";, c.x, c.y,
> > 17-zoom)
>
> > The fractional part times 256 is the pixel coordinate within the tile
> > itself.
>
> > Regards
>
> > using System;
> > using System.Collections.Generic;
> > using System.Text;
>
> > namespace TileRequest {
> >     class TileCoordinate {
> >         public TileCoordinate(double lat, double lon, int zoom) {
> >             this.lat = lat;
> >             this.lon = lon;
> >             this.zoom = zoom;
> >         }
> >         public double y;
> >         public double x;
>
> >         public double lat;
> >         public double lon;
> >         public int zoom;
>
> >         public bool locationCoord() {
> >             if (System.Math.Abs(this.lat) > 85.0511287798066)
> >                 return false;
> >             double sin_phi = System.Math.Sin(this.lat * System.Math.PI /
> > 180);
> >             double norm_x = this.lon / 180;
> >             double norm_y = (0.5 * System.Math.Log((1 + sin_phi) / (1 -
> > sin_phi))) / System.Math.PI;
> >             this.y = System.Math.Pow(2, this.zoom) * ((1 - norm_y) / 2);
> >             this.x = System.Math.Pow(2, this.zoom) * ((norm_x + 1) / 2);
> >             return true;
> >         }
> >     }
>
> > }- Hide quoted text -
>
> > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to