pfrater / arcpullr

21 stars 9 forks source link

Error with features that have no associated geometry #2

Closed stevenbedrick closed 1 year ago

stevenbedrick commented 1 year ago

Hello, and thank you for an incredibly useful package! I have run into an issue where a specific dataset that I am working with has one feature which somehow does not have geometry associated with it, leading to a crash in esri2sfPoint() here; presumably, if it were a different type of geometry (i.e., not a point, but perhaps a polygon) the same problem could occur. Obviously, this is not an ideal situation to be in from a data standpoint, and until now I had never actually seen a feature with no geometry- but given that it is (apparently) possible to build such a dataset in ArcGIS, it seems like something that arcpullr ought to support.

The feature in question is Object ID 6926 in this dataset: https://maps.ihs.gov/server/rest/services/OPHS/enterprise/MapServer/7/

I am not sure what the best way to handle this sort of situation would be from the standpoint of arcpullr's API and behavior. I don't know whether sf objects are able to include features that have no associated geometry, but if they are, I suppose one option would be to include the feature and its attributes? Another option would be to just skip these features altogether. In either event, I would imagine a warning to the user would be in order. Thoughts?

pfrater commented 1 year ago

Steven, thanks for the kind words about the package and the incredibly helpful pinpoint of the bug location. This same instance must have happened with polygons at some point because there was a fix in that function. I've pushed a fix to github, so you can re-install there. I'll get the package into CRAN sooner or later.

stevenbedrick commented 1 year ago

Fabulous, thanks for the fast fix! :-)