sabato 3 novembre 2007

GMGeodecoder: a class findig places and based on Google Maps

In the last post I proposed a simple web custom control based on the Microsoft Virtual Earth APIs, now a similar class (only places, not business) based on the Google Maps HTTP Geodecoding Service (so it's totally server side, no Ajax, no Javascript).

The class CalSoft.GMGeodecoder has only the constructor and a public method:

public GMGeodecoder(string sGMKey)

This is the constructor with only one parameter: the google maps API key. I'm not sure it is required, but, of course, according to the service description on the manual you must provide it (if you need a google maps API key for your site you can obtain it free here).

public GMPlace GetPlace(string sPlace)

Method that performs a search for the location specified on sPlace and returns a GMPlace structures.

public struct CalSoft.GMPlace

Single Latitude and Longitude
obviously the latitude and longitude of the result place

int Accuracy

an integer representing the accuracy of the result according to that table

int StatusCode
status code of the HTTP request

string Result
the full string returned from the HTTP request

You can download the class by clicking here or test it here.

Good work!

Nessun commento: