0

I am trying to understand the meaning of this error. I created spatial data using the sf package in R and wrote out the data as a GeoPackage (i.e. a .gpkg). However, whenever I add the data into ArcMap, I receive the following error.

enter image description here

Unfortunately, my reproducible R example works and my real example still does not, thus something must be wrong with my code. And I cannot figure out what it is. The real code is too long and cannot be copied here.

The weird thing is that when I write the data in R out as a shapefile, there is no error and the data is correctly spatially referenced, etc. What does this error mean? And why would it produce as a .gpkg and not as a .shp?

A similar error message was seen here, but it is a little different.

  • 1
    Maybe you have some invalid field name? When you export to shapefile the field names are truncated and maybe the error is being truncated away – BERA Apr 23 '19 at 15:55
  • Which version of ArcMap? Unlikely; but maybe an older version not understanding the contents of the package? – KHibma Apr 23 '19 at 17:06
  • @KHibma, ArcGIS Desktop 10.6.1. – Phil Apr 23 '19 at 17:40
  • @BERA, I think that maybe an issue as one of my fields is called "Unique.ID". Can geopackage file types not accept "."s in field names? – Phil Apr 23 '19 at 17:40
  • 1
    @BERA, thank you for the help! It has a worked. I replaced a "." with "_" and my geopackage could be read into ArcMap. Thank you! – Phil Apr 24 '19 at 15:39
0

For clarification, @BERA's comment was correct. There were invalid field names. In my R Script, I simply added the below line of code to remove .'s and to replace them with _'s. Assuming your dataframe or sf object is called df:

# Remove dots from column (field) names and replace with _
colnames(df) <- gsub("\\.", "_", colnames(df))

should do it.

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