Opened 9 years ago

Closed 9 years ago

#6016 closed defect (fixed)

What is the EPSG 4326 doing in the GeoJSON test?

Reported by: Kurt Schwehr Owned by: hobu
Priority: low Milestone:
Component: default Version: unspecified
Severity: minor Keywords:
Cc:

Description

In geojson test 11at source:trunk/autotest/ogr/ogr_geojson.py#L562, the GCS is coming back as 4269. Why is the test checking against 4326? Also, is it ever okay for pcs to not come back with 26915?

srs.GetAuthorityCode('GEOGCS')
Out[]: '4269'
    ref = lyr.GetSpatialRef()
    gcs = int(ref.GetAuthorityCode('GEOGCS'))
    pcs = ref.GetAuthorityCode('PROJCS')
    if pcs:
        pcs = int(pcs)
    if  not gcs == 4326 and not pcs == 26915:
        gdaltest.post_reason("Spatial reference was not valid")
        return 'fail'

I think this code should be:

    ref = lyr.GetSpatialRef()
    gcs = int(ref.GetAuthorityCode('GEOGCS'))
    pcs = int(ref.GetAuthorityCode('PROJCS'))
    if  gcs != 4269 or pcs != 26915:
        gdaltest.post_reason('Spatial reference was not valid')
        return 'fail'

Any reason I shouldn't submit this?

Change History (4)

comment:1 by Kurt Schwehr, 9 years ago

Also, Why in this test does the layer report a different PCS than the geometry? 26915 versus 26916?

comment:2 by Kurt Schwehr, 9 years ago

Owner: changed from warmerdam to hobu

comment:3 by Even Rouault, 9 years ago

@goatbar

This test looks more convoluted than necessary (and the 'and 'should normally be a 'or' indeed). Only the PCS should be tested. The fact that PCS foo includes GCS bar isn't something specific to GeoJSON. Feel free to simplify it.

comment:4 by Kurt Schwehr, 9 years ago

Resolution: fixed
Status: newclosed

r29445 cleans up the test.

Looking at srs_name.geojson, I see that there is an overall srs and the point feature overrides that.

Note: See TracTickets for help on using tickets.