epsg.io icon indicating copy to clipboard operation
epsg.io copied to clipboard

OGC WKT2 Syntax

Open marqh opened this issue 4 years ago • 4 comments

Hello epsg.io

I would like to enquire about the syntax of the WKT presentation of CRS definitions within https://epsg.io

The OGC produce and publish the encoding standard for WKT-CRS https://www.ogc.org/standards/wkt-crs

However, the published versions of WKT-CRS on epsg.io use a legacy syntax.

From the OGC standard:

If the WKT begins with or contains any of the following keywords, it is an older format:

    COMPDCS, FITTED_CS, GEOCCS, GEOGCS, LOCAL_CS, PROJCS, VERT_CS.

"Geographic information — Well known text representation of coordinate reference systems" was published by the OGC in 2012, and has been updated, including in 2018.

For example, epsg.io publishes https://epsg.io/4326.prettywkt

GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0,
        AUTHORITY["EPSG","8901"]],
    UNIT["degree",0.0174532925199433,
        AUTHORITY["EPSG","9122"]],
    AUTHORITY["EPSG","4326"]]

This is not the same as the official EPSG Registry definition, which conforms to the OGC WKT-CRS standard: http://www.epsg-registry.org/export.htm?wkt=urn:ogc:def:crs:EPSG::4326

GEODCRS["WGS 84",
  DATUM["World Geodetic System 1984",
    ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1.0]]],
  CS[ellipsoidal,2],
    AXIS["latitude",north,ORDER[1]],
    AXIS["longitude",east,ORDER[2]],
    ANGLEUNIT["degree",0.01745329252],
  ID["EPSG",4326]]

For example:

  • ~~GEOGCS~~ GEODCRS
  • ~~UNIT~~ ANGLEUNIT *~~_~~ CS[...]
  1. Please may you provide some information on this ticket of the version and provenance of WKT-CRS that is in use within epsg.io?
  2. Please may you advise users of the website of this information? At present, it is not clear that the syntax in use may be outdated and unrecognised by parsing tools?
  3. Please may you advice this ticket of your plans to update the WKT-CRS encoding presentation to conform to the OGC WKT-CRS standard?

thank you marqh

marqh avatar Jun 16 '20 08:06 marqh

Hi @marqh !

Thanks for alerting us on this WKT formatting issue.

The EPSG.io uses the Proj4 library ExportToPrettyWkt() and ExportToWkt() to generate the WKT code. For example at https://github.com/maptiler/epsg.io/blob/master/app.py#L1295

I see there has been an update related to OGC WKT2 syntax done - now available in the recent releases of Proj. So once the update to the latest Proj library version id done - this issue is going to be fixed.

A great amount of work has been done on the Proj library by @hobu @rouault and others involved in https://gdalbarn.com/ - also on the simplified data management and releases of the EPSG database in the compact SQLite form. 👏

I really wish the EPSG.io website to be updated to the latest Proj - but at this moment we lack the capacity to work on that in the coming months.

Any pull request from the open-source community - or a client willing to support us or somebody else to do the related work may speed up this change. If you have the python+epsg expertise feel free to fork this project and make a pull request. We would be very happy to review and merge such a contribution to this open-source code.

klokan avatar Jun 16 '20 09:06 klokan

Hello @klokan

many thanks for the response, that's really helpful.

Given the understandable constraints

I really wish the EPSG.io website to be updated to the latest Proj - but at this moment we lack the capacity to work on that in the coming months.

Have you considered adding a note/disclaimer/warning, perhaps into a template used on your site?

This could point unwary travellers to the risks of using this legacy syntax until these updates are in place. It is just a thought.

thanks again marqh

marqh avatar Jun 17 '20 10:06 marqh

Check https://epsg.io/4326.wkt2 that prints WKT2(2019). If it looks correct then this ticket can be closed.

jratike80 avatar Sep 23 '22 07:09 jratike80

The following formats can be used in this version of epsg.io:

 'wkt', 'wkt2', 'esriwkt', 'json', 'proj4', 'js', 'mapfile', 'mapnik', 'mapserverpython', 'mapnikpython', 'geoserver', 'sql'

A new JSON format is also added. It's pretty useful for extracting properties from CRS: https://epsg.io/4326.json

AliFlux avatar Sep 29 '22 08:09 AliFlux