locked
Shapefile WKT format, specification RRS feed

  • Question

  • Hi,

    I am looking for information regarding shapefile WKT format and specification. For example: the WKT for EPSG 277000 shown below:

    ROJCS["OSGB 1936 / British National Grid",
        GEOGCS["OSGB 1936",
            DATUM["OSGB_1936",
                SPHEROID["Airy 1830",6377563.396,299.3249646,
                    AUTHORITY["EPSG","7001"]],
                AUTHORITY["EPSG","6277"]],
            PRIMEM["Greenwich",0,
                AUTHORITY["EPSG","8901"]],
            UNIT["degree",0.01745329251994328,
                AUTHORITY["EPSG","9122"]],
            AUTHORITY["EPSG","4277"]],
        UNIT["metre",1,
            AUTHORITY["EPSG","9001"]],
        PROJECTION["Transverse_Mercator"],
        PARAMETER["latitude_of_origin",49],
        PARAMETER["central_meridian",-2],
        PARAMETER["scale_factor",0.9996012717],
        PARAMETER["false_easting",400000],
        PARAMETER["false_northing",-100000],
        AUTHORITY["EPSG","27700"],
        AXIS["Easting",EAST],
        AXIS["Northing",NORTH]]

    http://spatialreference.org/ref/epsg/27700/html/

     

    Can the last AUTHORITY above be changed to the last line, like this:

    ROJCS["OSGB 1936 / British National Grid",
        GEOGCS["OSGB 1936",
            DATUM["OSGB_1936",
                SPHEROID["Airy 1830",6377563.396,299.3249646,
                    AUTHORITY["EPSG","7001"]],
                AUTHORITY["EPSG","6277"]],
            PRIMEM["Greenwich",0,
                AUTHORITY["EPSG","8901"]],
            UNIT["degree",0.01745329251994328,
                AUTHORITY["EPSG","9122"]],
            AUTHORITY["EPSG","4277"]],
        UNIT["metre",1,
            AUTHORITY["EPSG","9001"]],
        PROJECTION["Transverse_Mercator"],
        PARAMETER["latitude_of_origin",49],
        PARAMETER["central_meridian",-2],
        PARAMETER["scale_factor",0.9996012717],
        PARAMETER["false_easting",400000],
        PARAMETER["false_northing",-100000],
        AXIS["Easting",EAST],
        AXIS["Northing",NORTH],

        AUTHORITY["EPSG","27700"]


    ]


    Thanks in advance!!
    Sunday, November 21, 2010 8:55 PM

Answers

  • You can view the official WKT  standard in section 6.4 (pg 33) of the Open Geospatial Consortium's "Simple Feature" specification:

    http://portal.opengeospatial.org/files/?artifact_id=13227

     

    There's nothing in there I can see about the AUTHORITY keyword at all, nor about the explicit order in which parameters should be stated. Since the WKT uses a nested bracket structure, it's unambiguous whatever order the parameters are supplied in, and I'd expect a WKT parser to be able to handle this.


    Beginning Spatial with SQL Server http://www.apress.com/book/view/1430218290
    • Marked as answer by Pingpong689 Monday, November 22, 2010 10:28 AM
    Monday, November 22, 2010 8:00 AM
    Answerer

All replies

  • Hi there,

    Firstly, that's the WKT of a spatial reference system , not the WKT of a shapefile :)

    Secondly, I don't believe it matter what order the parameters are specified in (certainly not to a good WKT parser). The AUTHORITY line is most commonly seen at the end of each section, but it doesn't have to be (in fact, it's sometimes not present at all).

    So, the two examples above are completely equivalent.


    Beginning Spatial with SQL Server http://www.apress.com/book/view/1430218290
    Sunday, November 21, 2010 9:19 PM
    Answerer
  • @tanoshimi,

    Based on your explanation, I have to modify the source code that SharpMap uses (The way it parses WKT is equentially looking for elements in order.).

    Could other elements appear differently in order? For example like below:

     

    ROJCS["OSGB 1936 / British National Grid",
        GEOGCS["OSGB 1936",
            DATUM["OSGB_1936",
                SPHEROID["Airy 1830",6377563.396,299.3249646,
                    AUTHORITY["EPSG","7001"]],
                AUTHORITY["EPSG","6277"]],
            PRIMEM["Greenwich",0,
                AUTHORITY["EPSG","8901"]],
            UNIT["degree",0.01745329251994328,
                AUTHORITY["EPSG","9122"]],
            AUTHORITY["EPSG","4277"]],

        PROJECTION["Transverse_Mercator"],
        PARAMETER["latitude_of_origin",49],
        PARAMETER["central_meridian",-2],
        PARAMETER["scale_factor",0.9996012717],
        PARAMETER["false_easting",400000],
        PARAMETER["false_northing",-100000],

        UNIT["metre",1,
            AUTHORITY["EPSG","9001"]],        

        AXIS["Easting",EAST],
        AXIS["Northing",NORTH],

        AUTHORITY["EPSG","27700"]


    ]

     

    I thnk there must be a specification for this.

    Sunday, November 21, 2010 9:56 PM
  • You can view the official WKT  standard in section 6.4 (pg 33) of the Open Geospatial Consortium's "Simple Feature" specification:

    http://portal.opengeospatial.org/files/?artifact_id=13227

     

    There's nothing in there I can see about the AUTHORITY keyword at all, nor about the explicit order in which parameters should be stated. Since the WKT uses a nested bracket structure, it's unambiguous whatever order the parameters are supplied in, and I'd expect a WKT parser to be able to handle this.


    Beginning Spatial with SQL Server http://www.apress.com/book/view/1430218290
    • Marked as answer by Pingpong689 Monday, November 22, 2010 10:28 AM
    Monday, November 22, 2010 8:00 AM
    Answerer
  • @tanoshimi,

     

    According to the spec (pg 34), Both AUTHORITY and AXIS at the end are NOT specified, shown below for your reference:

    <coordinate system> = <projected cs> | <geographic cs> | <geocentric cs>
    <projected cs> = PROJCS["<name>", <geographic cs>, <projection>, {<parameter>,}* <linear unit>]
    <projection> = PROJECTION["<name>"]
    <parameter> = PARAMETER["<name>", <value>]
    <value> = <number>

     

    So, to determine which spatial reference system it is is,  by comparing parameters, and the name of PROJCS? Can it unambiguously tell me by only comparing parameters (I remember you mentioned in other thread)?

    Monday, November 22, 2010 10:27 AM