My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
Issue 3: Address coordinate parsing does not work under cs-CZ culture
  Back to list
Status:  Fixed
Owner:  chadl...@gmail.com
Closed:  Aug 2008


 
Project Member Reported by chadl...@gmail.com, Aug 5, 2008
See here:
http://groups.google.com/group/geocodingnet/browse_thread/thread/5927d2520444a525

Hi,

I found a bug in FromCoordinates method of GoogleGeoCoder class. When
you run the code under different culture setting then en-US (cs-CZ in
my case) you get "Input string was not in a correct format exception"
at line 66:
double longitude = double.Parse(coordinates[0]);

Possible fix:
        private Location FromCoordinates(string[] coordinates)
        {
            CultureInfo ci = new CultureInfo("en-US");
            double longitude = double.Parse(coordinates[0],
(IFormatProvider)ci.NumberFormat);
            double latitude = double.Parse(coordinates[1],
(IFormatProvider)ci.NumberFormat);
            Location gpsCoordinates = new Location(latitude,
longitude);
            return gpsCoordinates;
        }

Please note I have not read the documentation of the Google GeoCoding
API so I only suppose the format of the returned coordinates is en-
US.

Thanks
Leos
Aug 5, 2008
Project Member #1 chadl...@gmail.com
(No comment was entered for this change.)
Status: Fixed

Powered by Google Project Hosting