2

I am trying to export multiple layers of point data from R as a single GeoPackage. The code works fine (included below), however when I try and load the resulting GeoPackage into ArcMap (10.6) I get the following pop-up:

ArcMap pop-up

Followed by this error:

ArcMap Error

I've not had this issue before when exporting GeoPackages from R and loading them in ArcMap and am not sure what is causing these problems (especially when it loads into QGIS fine). I have tried both writeOGR and st_write to export as a GeoPackage but encounter the same issue with both.

require("raster")
require("sf")

Data1 <- read.csv(sprintf("https://docs.google.com/uc?id=%s&export=download", "1RHAqtsPXgD5rH-ppIu7cLblHXyXzv_39"))
Data2 <- read.csv(sprintf("https://docs.google.com/uc?id=%s&export=download", "1Mzi6A6L_cXOrT9dTbm8gggGdtNQnZYkY"))
Data3 <- read.csv(sprintf("https://docs.google.com/uc?id=%s&export=download", "1ZzYiFIJxs2Coeb4kBNsWhmiF5NZDUhrL"))

Data1_Coords <- cbind(Easting = as.numeric(as.character(Data1$OSEAST1M)),Northing = as.numeric(as.character(Data1$OSNRTH1M)))
Data2_Coords <- cbind(Easting = as.numeric(as.character(Data2$OSEAST1M)),Northing = as.numeric(as.character(Data2$OSNRTH1M)))
Data3_Coords <- cbind(Easting = as.numeric(as.character(Data3$OSEAST1M)),Northing = as.numeric(as.character(Data3$OSNRTH1M)))

Data1_Points <- SpatialPointsDataFrame(Data1_Coords, data = Data1, proj4string = CRS("+init=epsg:27700"))
Data2_Points <- SpatialPointsDataFrame(Data2_Coords, data = Data2, proj4string = CRS("+init=epsg:27700"))
Data3_Points <- SpatialPointsDataFrame(Data3_Coords, data = Data3, proj4string = CRS("+init=epsg:27700"))

Data1_Points_ST <- st_as_sf(Data1_Points)
Data2_Points_ST <- st_as_sf(Data2_Points)
Data3_Points_ST <- st_as_sf(Data3_Points)

st_write(Data1_Points_ST, "DataGPKG.gpkg", "Data1")
st_write(Data2_Points_ST, "DataGPKG.gpkg", "Data2", update = TRUE)
st_write(Data3_Points_ST, "DataGPKG.gpkg", "Data3", update = TRUE)

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.