Skip to content

Commit

Permalink
GPKG: capitalize cartesian as Cartesian for SRS of id -1 'Undefined C…
Browse files Browse the repository at this point in the history
…artesian coordinate reference system' (#4468)
  • Loading branch information
edzer authored Sep 11, 2021
1 parent a51ccc1 commit fd3f98b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
8 changes: 4 additions & 4 deletions autotest/gdrivers/gpkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -1204,7 +1204,7 @@ def test_gpkg_15():
# Repeated SetProjection()
out_ds = gdal.Open('/vsimem/tmp.gpkg', gdal.GA_Update)
assert out_ds.GetSpatialRef().IsLocal()
assert out_ds.GetProjectionRef().find('Undefined cartesian SRS') >= 0
assert out_ds.GetProjectionRef().find('Undefined Cartesian SRS') >= 0
srs = osr.SpatialReference()
srs.ImportFromEPSG(4326)
ret = out_ds.SetProjection(srs.ExportToWkt())
Expand All @@ -1219,7 +1219,7 @@ def test_gpkg_15():

out_ds = gdal.Open('/vsimem/tmp.gpkg')
assert out_ds.GetSpatialRef().IsLocal()
assert out_ds.GetProjectionRef().find('Undefined cartesian SRS') >= 0
assert out_ds.GetProjectionRef().find('Undefined Cartesian SRS') >= 0
# Test setting on read-only dataset
gdal.PushErrorHandler()
ret = out_ds.SetProjection('')
Expand Down Expand Up @@ -3226,12 +3226,12 @@ def test_gpkg_wkt2():

lyr = ds.ExecuteSQL('SELECT * FROM gpkg_spatial_ref_sys ORDER BY srs_id')
f = lyr.GetNextFeature()
assert f.GetField('srs_name') == 'Undefined cartesian SRS'
assert f.GetField('srs_name') == 'Undefined Cartesian SRS'
assert f.GetField('srs_id') == -1
assert f.GetField('organization') == 'NONE'
assert f.GetField('organization_coordsys_id') == -1
assert f.GetField('definition') == 'undefined'
assert f.GetField('description') == 'undefined cartesian coordinate reference system'
assert f.GetField('description') == 'undefined Cartesian coordinate reference system'
assert f.GetField('definition_12_063') == 'undefined'

lyr.GetNextFeature()
Expand Down
18 changes: 9 additions & 9 deletions autotest/ogr/ogr_gpkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -1631,11 +1631,11 @@ def test_ogr_gpkg_write_srs_undefined_geographic():
gdal.Unlink('tmp/ogr_gpkg_srs_undefined_geographic.gpkg')


def test_ogr_gpkg_write_srs_undefined_cartesian():
def test_ogr_gpkg_write_srs_undefined_Cartesian():

gdal.Unlink('tmp/ogr_gpkg_srs_cartesian.gpkg')
gdal.Unlink('tmp/ogr_gpkg_srs_Cartesian.gpkg')

gpkg_ds = gdaltest.gpkg_dr.CreateDataSource('tmp/ogr_gpkg_srs_cartesian.gpkg')
gpkg_ds = gdaltest.gpkg_dr.CreateDataSource('tmp/ogr_gpkg_srs_Cartesian.gpkg')
assert gpkg_ds is not None

# Check initial default SRS entries in gpkg_spatial_ref_sys
Expand All @@ -1645,14 +1645,14 @@ def test_ogr_gpkg_write_srs_undefined_cartesian():
gpkg_ds.ReleaseResultSet(sql_lyr)

srs= osr.SpatialReference()
srs.SetFromUserInput('LOCAL_CS["Undefined cartesian SRS"]')
lyr = gpkg_ds.CreateLayer('srs_test_cartesian_layer', geom_type=ogr.wkbPoint, srs=srs)
srs.SetFromUserInput('LOCAL_CS["Undefined Cartesian SRS"]')
lyr = gpkg_ds.CreateLayer('srs_test_Cartesian_layer', geom_type=ogr.wkbPoint, srs=srs)
srs_wkt = lyr.GetSpatialRef().ExportToWkt()
assert srs_wkt.find('Undefined cartesian SRS') >= 0
assert srs_wkt.find('Undefined Cartesian SRS') >= 0
assert lyr.GetSpatialRef().IsLocal()

gpkg_ds = None
gpkg_ds = ogr.Open('tmp/ogr_gpkg_srs_cartesian.gpkg')
gpkg_ds = ogr.Open('tmp/ogr_gpkg_srs_Cartesian.gpkg')

# Check no new SRS entries have been inserted into gpkg_spatial_ref_sys
sql_lyr = gpkg_ds.ExecuteSQL("SELECT COUNT(*) FROM gpkg_spatial_ref_sys")
Expand All @@ -1661,11 +1661,11 @@ def test_ogr_gpkg_write_srs_undefined_cartesian():

lyr = gpkg_ds.GetLayer(0)
srs_wkt = lyr.GetSpatialRef().ExportToWkt()
assert srs_wkt.find('Undefined cartesian SRS') >= 0, srs_wkt
assert srs_wkt.find('Undefined Cartesian SRS') >= 0, srs_wkt
assert lyr.GetSpatialRef().IsLocal()

gpkg_ds = None
gdal.Unlink('tmp/ogr_gpkg_srs_cartesian.gpkg')
gdal.Unlink('tmp/ogr_gpkg_srs_Cartesian.gpkg')

###############################################################################
# Test maximum width of text fields
Expand Down
8 changes: 4 additions & 4 deletions gdal/ogr/ogrsf_frmts/gpkg/ogrgeopackagedatasource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ OGRSpatialReference* GDALGeoPackageDataset::GetSpatialRef(int iSrsId,
}
else if( iSrsId == -1)
{
poSpatialRef->SetLocalCS("Undefined cartesian SRS");
poSpatialRef->SetLocalCS("Undefined Cartesian SRS");
poSpatialRef->SetLinearUnits( SRS_UL_METER, 1.0 );
}

Expand Down Expand Up @@ -582,7 +582,7 @@ int GDALGeoPackageDataset::GetSrsId(const OGRSpatialReference& oSRS)
if (EQUAL(pszName, "Undefined geographic SRS"))
return 0;

if (EQUAL(pszName, "Undefined cartesian SRS"))
if (EQUAL(pszName, "Undefined Cartesian SRS"))
return -1;
}
}
Expand Down Expand Up @@ -932,7 +932,7 @@ GDALGeoPackageDataset::GDALGeoPackageDataset() :
m_bMetadataDirty(false),
m_bRecordInsertedInGPKGContent(false),
m_bGeoTransformValid(false),
m_nSRID(-1), // Unknown cartesian.
m_nSRID(-1), // Unknown Cartesian.
m_dfTMSMinX(0.0),
m_dfTMSMaxY(0.0),
m_nOverviewCount(0),
Expand Down Expand Up @@ -4179,7 +4179,7 @@ int GDALGeoPackageDataset::Create( const char * pszFilename,
osSQL += ", definition_12_063";
osSQL +=
") VALUES ("
"'Undefined cartesian SRS', -1, 'NONE', -1, 'undefined', 'undefined cartesian coordinate reference system'";
"'Undefined Cartesian SRS', -1, 'NONE', -1, 'undefined', 'undefined Cartesian coordinate reference system'";
if( m_bHasDefinition12_063 )
osSQL += ", 'undefined'";
osSQL +=
Expand Down

0 comments on commit fd3f98b

Please sign in to comment.