GeometryJSON serializes JSON coordinates with incorrect coordinate ordering

Description

I'm not sure if I'm doing something wrong here, but from everything I can tell, the coordinate ordering from the GeometryJSON class is incorrect.

Specifically:

https://github.com/geotools/geotools/blob/master/modules/unsupported/geojson/src/main/java/org/geotools/geojson/geom/GeometryJSON.java#L684-L712

It seems to write the coordinate ordering as:

For every coordinate, which given the expected coordinate ordering in most of geotools, seems to be lat, long:

https://docs.geotools.org/latest/userguide/library/referencing/order.html

However, GeoJSON seems to be special in that its specification says that all coordinates should be:

http://wiki.geojson.org/GeoJSON_draft_version_6

For type "Point", each element in the coordinates array is a number representing the point coordinate in one dimension. There must be at least two elements, and may be more. The order of elements must follow x, y, z order (or longitude, latitude, altitude for coordinates in a geographic coordinate reference system). Any number of additional dimensions are allowed, and interpretation and meaning of these coordinates is beyond the scope of this specification.

It seems like the GeometryJSON class should respect the input Coordinate ordering and flip the output ordering correctly.

Environment

None

Status

Assignee

Unassigned

Reporter

Mike Glazer

Triage

None

Affects versions

Priority

Medium
Configure