views:

161

answers:

1

Hi,

I want to get latitude and longitude from address in one of my asp.net application, i know it s possible using google apis but i want to do it without showing google map. How can i do that? I also want to get distance between two pairs of latitude and longitude. Please guide me in that regards also.

Thanks Pankaj

A: 

You need to do everything in an onload function, as described at http://code.google.com/apis/maps/documentation/introduction.html#Loading_the_Maps_API . The basic idea (using version 2 of the API) is :

var coder = new GClientGeocoder();
coder.getLatLng(
                "Addr to Geocode",
                function(point) {
                    if (point) {
                        // Do something with GLatLng point                
                    }
                }
            );

To get the distance (in meters), do:

point1.distanceFrom(point2)
Matthew Flaschen