Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid GeoJSON output. #188

Open
ssrebelious opened this issue Feb 8, 2019 · 2 comments
Open

Invalid GeoJSON output. #188

ssrebelious opened this issue Feb 8, 2019 · 2 comments

Comments

@ssrebelious
Copy link

In my model I have a linestring field with EPSG:3857: geom = LineStringField(srid=3857). Using djangorestframework-gis==0.14 I get output coordinate values like this:

{"type": "LineString", "coordinates": [[4162390.815448472, 7521835.900630971], [4161637.5299245478, 7521415.799088784], [4161478.181063718, 7520778.403645463]]}

Obviously I have output coordinates in EPSG:3857 and not in EPSG:4326. This violates GeoJSON specification:

4.  Coordinate Reference System

   The coordinate reference system for all GeoJSON coordinates is a
   geographic coordinate reference system, using the World Geodetic
   System 1984 (WGS 84) [WGS84] datum, with longitude and latitude units
   of decimal degrees.  This is equivalent to the coordinate reference
   system identified by the Open Geospatial Consortium (OGC) URN
   urn:ogc:def:crs:OGC::CRS84.  An OPTIONAL third-position element SHALL
   be the height in meters above or below the WGS 84 reference
   ellipsoid.  In the absence of elevation values, applications
   sensitive to height or depth SHOULD interpret positions as being at
   local ground or sea level.

   Note: the use of alternative coordinate reference systems was
   specified in [GJ2008], but it has been removed from this version of
   the specification because the use of different coordinate reference
   systems -- especially in the manner specified in [GJ2008] -- has
   proven to have interoperability issues.  In general, GeoJSON
   processing software is not expected to have access to coordinate
   reference system databases or to have network access to coordinate
   reference system transformation parameters.  However, where all
   involved parties have a prior arrangement, alternative coordinate
   reference systems can be used without risk of data being
   misinterpreted.
@nemesifier nemesifier added the bug label Dec 9, 2019
@nemesifier
Copy link
Member

So the right solution is to output only in WGS 84 format.

@StefanBrand
Copy link

Workaround is documented here: #250 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants