xmlgeojsonqgisgml-geographic-markup-lan

Order of coordinates in geojson


I was testing rendering of data via GitHub in geojson format, because I wanted to use it for INSPIRE data. INSPIRE data are in GML 3.2.1 format. I've downloaded one of datasets from http://services.cuzk.cz/gml/inspire/cp/epsg-4258/ (which is in ETRS).

I needed to get json file from it, so I've opened GML file in Quantum GIS (version 1.9) and saved it like geojson file (CRS=EPSG::4326) and then uploaded to my GitHub. Order of coordinates in geojson is (easting, northing), but after saving file from QGIS it's (northing, easting). My data comes from Czech Republic, but it's rendered in Yemen. Does anybody have any experience with this problem? Does anybody know how to switch order of coordinates (or axis) in geojson file?

I have much more experience with xml based data formats than with json and because of that I hope that this isn't so silly question.


Solution

  • For anyone up there looking for the answer for the question in the title:

    Coordinates order is longitude and latitude, or easting and northing.

    Source:

    3.1.1. Position

    A position is the fundamental geometry construct. The "coordinates" member of a Geometry object is composed of either:

    o one position in the case of a Point geometry,

    o an array of positions in the case of a LineString or MultiPoint geometry,

    o an array of LineString or linear ring (see Section 3.1.6) coordinates in the case of a Polygon or MultiLineString geometry, or

    o an array of Polygon coordinates in the case of a MultiPolygon geometry.

    A position is an array of numbers. There MUST be two or more
    elements. The first two elements are longitude and latitude, or
    easting and northing
    , precisely in that order and using decimal
    numbers. Altitude or elevation MAY be included as an optional third
    element.

    From GeoJSON specification