-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Description
This issue is dedicated to discuss further improvements to PR #3286 suggested by @rouault in #3286 (comment), quoting:
It occurs to me that we would probably want to do something on the writing side of the driver to be able to round-trip nicely those 2 special CRS.
@rouault I admit I'm having hard time trying to find an anchor for the 'writing side' in the GeoPackage driver - I have very little experience with the format.
Do you mean the driver is lacking as not accepting any of the two possible undefined SRS when new dataset/layer is created?
Putting it differently, what new test cases are expected to be covered (and any required implementation on the drivier added/changed, of course). Here is what I have just been scratching out:
def test_ogr_gpkg_write_srs_undefined():
ds = gdaltest.gpkg_dr.CreateDataSource('/vsimem/ogr_gpkg_srs_undefined.gpkg')
assert ds is not None
srs= osr.SpatialReference()
srs.SetFromUserInput('GEOGCS["Undefined geographic SRS",DATUM["unknown",SPHEROID["unknown",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AXIS["Latitude",NORTH],AXIS["Longitude",EAST]]')
lyr = ds.CreateLayer('srs_test_layer', geom_type=ogr.wkbPoint, srs=srs)
assert lyr.GetSpatialRef().ExportToWkt().find('Undefined geographic SRS') >= 0def test_gpkg_write_srs_undefined():
ds = gdaltest.gpkg_dr.Create('/vsimem/tmp.gpkg', 1, 1)
ds.SetGeoTransform([0, 1, 0, 0, 0, -1])
srs = osr.SpatialReference()
srs.ImportFromWkt('GEOGCS["Undefined geographic SRS",DATUM["unknown",SPHEROID["unknown",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AXIS["Latitude",NORTH],AXIS["Longitude",EAST]]')
ret = ds.SetSpatialRef(srs)
srs_got = ds.GetSpatialRef()
assert srs_got.IsSame(srs), srs_got.ExportI'll appreciate any hints or bearings where the driver is lacking.