Thursday, May 17, 2007

String to a GLatLng() object

Now we have a handy undocumented method

It converts a coordinate pair string like "60.21, 24.95" to a GLatLng object:

var latLngString = "60.21, 24.95"
var point = GLatLng.fromUrlValue(latLngString);

Nice. The method performs split(",") and parseFloat() for you. It simplifies parsing of many file formats. Actually I am converting my Spreadsheets to have a 'latlng' column instead of 'lat' and 'lng' columns. It makes copy-paste-filling of the spreadsheet easier.