On Mar 15, 11:24 am, ibgpsn <[email protected]> wrote:
>
> (I don't want to reverse geocode, i just want the map at the location)
>


On Mar 15, 11:24 am, ibgpsn <[email protected]> wrote:

> (I don't want to reverse geocode, i just want the map at the location)
>

It is overkill yet unreliable to use geocoder for parsing coordinates
out of address query string. It is quite simple to do that by
javascript.

Split the address string by comma and test if the two first two cells
are numbers by IsNan:

var query = address.split(",");
if(!isNaN(1*query[0] + 1*query[1])){
  map.panTo(new GLatLng(1*query[0], 1*query[1]));
}else{
  geocode(address);
}

You can also test that there is only one comma by (query.length==2) to
make sure that it is not an address starting with two comma separated
numbers.

Don't use parseInt() for converting strings to numbers. Use 1*
instead.

parseInt("42 Main Street") returns number 42 which is not intended.

I added those lines in the geocoder script of this page:
http://esa.ilmari.googlepages.com/wikipanocheck.htm

--~--~---------~--~----~------------~-------~--~----~
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