This project is read-only.

Generates incorrect GeoJSON


The GeoJson spec ( states:
A position is the fundamental geometry construct. The "coordinates" member of a geometry object is composed of one position (in the case of a Point geometry), an array of positions (LineString or MultiPoint geometries), an array of arrays of positions (Polygons, MultiLineStrings), or a multidimensional array of positions (MultiPolygon).

A position is represented by an array of numbers. There must be at least two elements, and may be more. The order of elements must follow x, y, z order (easting, northing, altitude for coordinates in a projected coordinate reference system, or longitude, latitude, altitude for coordinates in a geographic coordinate reference system). Any number of additional elements are allowed -- interpretation and meaning of additional elements is beyond the scope of this specification.
The key to this is that the order of coordinates is:
  1. Longitude
  2. Latitude
  3. Altitude (optional)
However, in the GeoJsonConvert.cs we see again and again code like this:
var point = new double[2];
point[0] = Math.Round((double)sp.Lat, 5);
point[1] = Math.Round((double)sp.Long, 5);
This generates GeoJson that looks like this:
"geometry": {
    "coordinates": [
    "type": "Point"
This is wrong because the Longitude should be the first coordinate, followed by the Latitude. The correct code should be:
var point = new double[2];
point[0] = Math.Round((double)sp.Long, 5);
point[1] = Math.Round((double)sp.Lat, 5);
This project hasn't been touched in centuries, but at least people still using it may find this helpful.