------------------
lonSign = lonSign = 1
if(aLatLon[2]=="S"){
latSign=-1;
}
if(aLatLon[5]=="W"){
lonSign=-1;
}
var lat=latSign*(aLatLon[0]+(aLatLon[1]/60))
var lon=lonSign*(aLatLon[3]+(aLatLon[4]/60))
...
map.setCenter(new GLatLng(parseFloat(lat), parseFloat(lon),true),5);
------------------
is how I would do it..
On 23/06/2009, okada <[email protected]> wrote:
>
> Thank you for your response.
>
> In our case, the location to show in the map is given in a lat/lng
> pair like "35 27 E 139 40 E", I tried the following.
>
> function showLocation(LatLon) {
> aLatLon=LatLon.split(" ");
> if(aLatLon[2]=="S"){
> latSign="-";
> }
> if(aLatLon[5]=="W"){
> lonSign="-";
> }
> var lat=latSign+aLatLon[0]+"."+Math.round((aLatLon[1]/60)*100);
> var lon=lonSign+aLatLon[3]+"."+Math.round((aLatLon[4]/60)*100);
> if(map==null){
> map=new GMap2(document.getElementById("map"));
> }
> map.setCenter(new GLatLng(parseInt(lat),parseInt(lon),true),5);
> ....
>
> I call this function from onload in body tag.
> This code does not work.
> Could you tell me what's wrong with this code?
>
>
> OKADA Makoto
>
>
> On Jun 19, 2009, at 6:54 PM, Mike Williams wrote:
>
> >
> > Don't use GClientGeocoder to convert lat/lng to lat/lng. It will
> > perform
> > reverse geocoding, and return the nearest named location that it knows
> > about, which might be a considerable distance away.
> >
> > --
> > Mike Williams
> > http://econym.org.uk/gmap
> >
> >
> >
> > >
>
>
> >
>
--
Barry
- www.nearby.org.uk - www.geograph.org.uk -
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---