-
Notifications
You must be signed in to change notification settings - Fork 299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for writing a non-spatial table to a GeoPackage #1345
Comments
florisvdh
added a commit
to inbo/n2khab-preprocessing
that referenced
this issue
Apr 8, 2020
Non-spatial tables need to be registered in the GeoPackage in order to conform to the GPKG standard. For now, this is done in a manual fashion, despite the ability of GDAL to take care of this for GPKG. I found no way to use this ability from R, so implemented the easy, though obsoleted approach of GeoPackage 1.0 to register non-spatial tables as data_type "aspatial" in the gpkg_contents table; see: https://gdal.org/drivers/vector/aspatial.html#vector-aspatial Question on implementation in R, see: r-spatial/sf#1345 The current way (GPKG 1.2) to handle this (data_type "attributes") is supported by GDAL, see: https://gdal.org/drivers/vector/gpkg.html#layer-creation-options . But it needs more work to do it manually, so made a GPKG 1.0 compliant version for now. See https://www.ogc.org/standards/geopackage . Note that GDAL is supportive when reading non-compliant gpkg-files, as it 'will also, by default, list non spatial tables that are not registered', which is why this worked beforehand with st_read(). See https://gdal.org/drivers/vector/gpkg.html#non-spatial-tables .
Incorporating this in |
edzer
added a commit
that referenced
this issue
May 16, 2020
Closed by #1396. |
edzer
added a commit
that referenced
this issue
Jul 7, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In its layer options, GDAL's GPKG-vector driver offers the possibility to store non-spatial attribute tables (~dataframes), using the option
ASPATIAL_VARIANT
. However it seems thatst_write()
does not support this:This throws an error:
Is there an alternative to properly use this GDAL feature from R, or else could it be incorporated in
st_write()
?An alternative is to manually insert the table with
RSQLite::dbWriteTable()
, which does work withst_read()
afterwards - probably because GDAL lists all non-spatial tables even when they were not registered in any GeoPackage system tables. However this approach of writing violates the GPKG standard, which e.g. requires registration of tables in thegpkg_contents
table.The text was updated successfully, but these errors were encountered: