Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 761
Meďák Avatar asked Sep 30 '13 15:09

Meďák


People also ask

Is GeoJSON Lat Long or Long LAT?

Nothing is in the wrong order. Leaflet uses lat-lng (or northing-easting ) whereas GeoJSON uses lng-lat (or easting-northing ).

What does GeoJSON data look like?

Coordinates in GeoJSON are formatted like numbers in JSON: in a simple decimal format. Unlike geographic data for human consumption, data formats never use non-base-10 encodings like sexagesimal. As cool as 8° 10' 23” looks, it's just not a very good way to tell numbers to computers.

What is GeoJSON point?

A GeoJSON object may represent a region of space (a Geometry), a spatially bounded entity (a Feature), or a list of Features (a FeatureCollection). GeoJSON supports the following geometry types: Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon, and GeometryCollection.

What CRS does GeoJSON use?

CRS (Coordinate Reference System) See https://tools.ietf.org/html/rfc7946#page-12 for further information. The coordinate reference system for all GeoJSON coordinates is a geographic coordinate reference system, using the World Geodetic System 1984 (WGS84) datum, with longitude and latitude units of decimal degrees.


1 Answers

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

like image 133
Tomasz Sabała Avatar answered Sep 24 '22 14:09

Tomasz Sabała