0

When creating a geopackage with ogr2ogr in WGS84 (EPSG:4326), the srs-definition string cannot be interpreted correctly when loading the data into ArcGIS. ArcGIS does not project the data corretly into my local SRS. I found, that ArcGIS expects another string for the SRS. So I am trying to set the new string with ogr2ogr and using the -a_srs -Option, as suggested here:

arcgis-geopackage-coordinate-system

Here is my command:

ogr2ogr -f GPKG test2.gpkg -a_srs "GEOGCS[^"GCS_WGS_1984^",DATUM[^"D_WGS_1984^",SPHEROID[^"WGS_1984^",6378137,298.257223563]],PRIMEM[^"Greenwich^",0],UNIT[^"Degree^",0.017453292519943295]]" test.gpkg

Inside the geopackage there is one line-layer, called "line_4326_gp". What am I doing wrong?

I retreive the string with this command:

gdalsrsinfo -o wkt_esri epsg:4326
  • 1
    sounds like you need to raise a bug report with ESRI, GeoPackage is an internationally agreed standard that they claim to support – Ian Turton Feb 5 at 10:24
  • Your ogr2ogr command is not complete because it is missing the source of data but I guess you have dropped it while editing your question. You are on Linux, aren't you? – user30184 Feb 6 at 9:19
  • It is on a windows-machine. The source should be a layer named "main.linie_4326_gp" in test.gpkg. I tried to add the layername, but maybe I did not use the correct notation, because I always got the error message that the datasource is missing. How do I add the layer correctly? – user7882389 Feb 7 at 8:47
2

ArcGIS should not expect a SRID string that you are trying to attach. The OGC implementation guide http://www.geopackage.org/guidance/implementation_guide.html has a link to sample GeoPackage that implements the lowest level SRS support the three built-in SRSs of EPSG::4326 (WGS-84), 0 (undefined geographic coordinate reference systems), and -1 (undefined Cartesian coordinate reference systems). That GeoPackage can be downloaded from https://portal.opengeospatial.org/files/?artifact_id=74984

The definition of that built-in EPSG:4326 is as follows:

GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137, 298.257223563,]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433]]

I suggest to download the sample database and try how ArcGIS deals with it.

EDIT

You can update the EPSG:4326 definitions in the gpkg_spatial_ref_sys table to be the same that ESRI is using with these two ogrinfo commands:

ogrinfo -sql "update gpkg_spatial_ref_sys set definition='GEOGCS[\"GCS_WGS_1984\",DATUM[\"D_WGS_1984\",SPHEROID[\"WGS_1984\",6378137.0,298.257223563]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]]' where srs_id=4326" ArcGis_geopackage_4326.gpkg

ogrinfo -sql "update gpkg_spatial_ref_sys set srs_name='GCS_WGS_1984' where srs_id=4326" ArcGis_geopackage_4326.gpkg

Commands are tested on Windows, on Linux you may need to escape the double quotes in some other way.

  • I agree with you that sending a bug report is necessary I did it. But even if they fix it it will not solve my problem, because for older versions, like ArcGIS 10.4, they will certainly not fix it. So my problem is still unresolved: how can I assign the SRS string to the geo package? – user7882389 Feb 5 at 21:01
  • Certainly you can assing your own SRS, every GeoPackage is an empty SQLite database initially. Could you create a new GeoPackage with ArcGIS and have a look at what is inserts into gpkg_spatial_ref_sys table for EPSG:4326? Even better if you could share such gpkg database. – user30184 Feb 6 at 9:16
  • A geopackage created with ArcGIS with a layer called "main.linie_4326_gp" can be downloaded here: drive.cnv.at/index.php/s/DPwEXYNBqRmA2Mr May whole process is built upon ogr2ogr, so I am trying to avoid writing directly into the tables of the geopackage. – user7882389 Feb 7 at 8:48
  • You can write directly into gpkg table with ogrinfo, see my edited answer. – user30184 Feb 7 at 9:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.