GoogleMapsAPI.NET icon indicating copy to clipboard operation
GoogleMapsAPI.NET copied to clipboard

Using the Directions API with GeoCoordinatesLocation fails in Swedish locale

Open svoff opened this issue 4 years ago • 0 comments

In the Swedish locale, floating point numbers use ',' rather than '.'

That means that in the following code from Converter.cs, dots will be replaced by commas, which messes up the URL, and hence NOT_FOUND is returned from Google. Suggest using InvariantCulture or similar.

        // Geo coordinates location
        if (locationType.InheritsOrImplements(typeof (IGeoCoordinatesLocation)))
        {
            var coordinates = (IGeoCoordinatesLocation) location;
            return $"{coordinates.Latitude},{coordinates.Longitude}";
        }

svoff avatar Oct 26 '20 12:10 svoff