This project is read-only.

GeoCoordinate constructor bug


I used the following constructor: "public GeoCoordinate(double[] values)" and it seems that the lat-long are reversed (so longitude must be first) which is quite a discrepancy compared to the other constructor.


xivk wrote Aug 30, 2013 at 11:53 AM


You are right:
        /// <summary>
        /// Creates a geo coordinate.
        /// </summary>
        /// <param name="longitude"></param>
        /// <param name="latitude"></param>
        public GeoCoordinate(double latitude,double longitude)
            :base(new double[]{longitude,latitude})

Will fix but this is definitely a breaking change (meaning not for v3.1) or some depending app may break.

Thanks for noticing.

xivk wrote Sep 3, 2013 at 9:28 AM


I investigated some more and this seems to be by design. I will update the comments on the constructor accepting the array to make this more clear.

This behaviour is default because most people use (latitude, longitude) but longitude can be seen as on the x-axis and latitude on the y-axis. This is why the when creating a new GeoCoordinate with an array for performance reasons this will not be reversed.