1

I am trying to work in R with the NYC 3D building models, specifically http://maps.nyc.gov/download/3dmodel/DA_WISE_Multipatch.zip. This is the package I use:

> library(sf)
Linking to GEOS 3.9.1, GDAL 3.2.1, PROJ 7.2.1; sf_use_s2() is TRUE

The GDAL docs say this:

The OpenFileGDB driver provides read access to vector layers of File Geodatabases (.gdb directories) created by ArcGIS 9 and above. The dataset name must be the directory/folder name, and it must end with the .gdb extension.

It can also read directly zipped .gdb directories (with .gdb.zip extension), provided they contain a .gdb directory at their first level.

A specific .gdbtable file (including “system” tables) can also be opened directly.

So it seems to be straightforward but I have been unsuccessful loading it into R using the SF package. I've tried loading the zip file with the directory in it and also a gdbtable file within the directory.

> model <- sf::st_read("DA_Wise_multipatch.zip")
Error: Cannot open "DA_WISE_Multipatch.zip"; The source could be corrupt or not supported. See `st_drivers()` for a list of supported formats.

How do I import this?

1 Answer 1

0

The multipatch.zip file contains a number of gdb directories. I solved the problem by extracting each of the gdb directories and then ZIPping each directory into it's own file. So the directory inside DA_WISE_multipatch.zip named

DA12_3D_Buildings_Multipatch.gdb

I extracted and re-compressed to a file named

DA12_3D_Buildings_Multipatch.gdb.zip

which sf is happy to load.

lower_man <- sf::st_read("DA12_3D_Buildings_Multipatch.gdb.zip")
Reading layer `Buildings_3D_Multipatch' from data source 
  `DA12_3D_Buildings_Multipatch.gdb.zip' 
  using driver `OpenFileGDB'
Simple feature collection with 24041 features and 3 fields
Geometry type: MULTIPOLYGON
Dimension:     XYZ
Bounding box:  xmin: 978979.2 ymin: 194479.1 xmax: 1002760 ymax: 220148.7
z_range:       zmin: -39.0159 zmax: 1797.107
Projected CRS: NAD83 / New York Long Island (ftUS)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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