-
Notifications
You must be signed in to change notification settings - Fork 301
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9178527
commit 14a9902
Showing
1 changed file
with
2 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14a9902
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that is what happens when the geometry column does not have a name, but when it has a name it does not happen: https://github.com/r-spatial/sf/blob/main/src/gdal_read.cpp#L76-L84
So with this PR, e.g. GPKG or PostGIS tables are read with a geometry column called
geom
orwkb_geometry
whenuse_stream=FALSE
(see code mentioned), but calledgeometry
whenuse_stream=TRUE
(this PR). I don't think that is good design, or why users can/should expect that.The reason to keep geometry names the way they come is the ability to do roundrips file -> sf -> file, without loss of information.
14a9902
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that the geometry column shouldn't have its name changed, but if I don't include the changes in this PR, users will get a different answer when reading a shapefile with
use_stream = TRUE
anduse_stream = FALSE
? Is there a better way to ensure that the output of the two matches without the code I've added here?14a9902
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name is currently being set to
wkb_geometry
, where does that happen? AFAICT, GDAL returns no name on shapefiles (link above), so we should be able to check this inCPL_read_gdal_stream
and set it there togeometry
?14a9902
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's the name that comes through on the stream (I didn't put it there!). I have an idea about that though (basically: I can check the geometry column name in the same way in C++ and add a less fragile name substitution).