Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Working with the Google Location API

Tags:

c#

geolocation

Forgive me for my ignorance, but after several hours of searching, I'm having little luck.

Anyway, I am attempting to write a small desktop application that will allow a user to enter an address and then have their approximate location returned in GPS coordinates. From what I can tell, Google provides a geocoding API[1] that allows requests in the following form:

http://maps.googleapis.com/maps/api/geocode/output?parameters

While I'm familiar with writing basic C Sharp applications, I really have no idea where to start when it comes to interfacing with this API. Any help that you guys could provide would be greatly appreciated.

like image 937
Bill Dance Avatar asked Jan 28 '11 02:01

Bill Dance


People also ask

Can we use Google Location API for free?

As mentioned, you won't be charged for your Google Maps API usage until you turn on auto-billing. The free trial limits you to $300 in credit over 90 days. API users also get $200 of credit per month toward API requests, equal to 100,000 static map requests or around 28,000 dynamic map requests per month.

How much does Google Location API cost?

Google Maps API uses the same pay-as-you-go system as Google Cloud, which means that you'll only pay for the APIs and SDKs you choose. The 28 APIs and SDKs that Google Maps offers are each priced individually based on usage per month, with a price range of $2-30 for every 1000 requests.

How does Google location work?

Most mobile phones are equipped with GPS, which uses signals from satellites to determine a device's location – however, with Google Location Services, additional information from nearby Wi-Fi, mobile networks, and device sensors can be collected to determine your device's location.


1 Answers

Fully documented .NET library -

Google Maps Web Services API wrapper for .NET https://github.com/maximn/google-maps/

//Directions
DirectionsRequest directionsRequest = new DirectionsRequest()
{
        Origin = "NYC, 5th and 39",
        Destination = "Philladephia, Chesnut and Wallnut",
};

        DirectionsResponse directions = MapsAPI.GetDirections(directionsRequest);

//Geocode
GeocodingRequest geocodeRequest = new GeocodingRequest()
{
        Address = "new york city",
};


GeocodingResponse geocode = MapsAPI.GetGeocode(geocodeRequest);

Console.WriteLine(geocode);

//Elevation
ElevationRequest elevationRequest = new ElevationRequest()
{
        Locations = new Location[] { new Location(54, 78) },
};


ElevationResponse elevation = MapsAPI.GetElevation(elevationRequest);

Console.WriteLine(elevation);
like image 199
Maxim Avatar answered Oct 09 '22 11:10

Maxim