[R-sig-Geo] tpk files

Edzer Pebesma edzer@pebe@m@ @end|ng |rom un|-muen@ter@de
Fri Apr 12 10:13:45 CEST 2019


Thanks; not sure this is what is intended, but it seemed to work:

> library(sf)
Linking to GEOS 3.7.0, GDAL 2.4.0, PROJ 5.2.0
> r = st_read("EMU.gpkg", query =
    "select * from EMU_Master where depth_lvl = 1")
Reading layer `EMU_Master' from data source
`/home/edzer/Downloads/EMU.gpkg' using driver `GPKG'
Simple feature collection with 677109 features and 33 fields
geometry type:  POINT
dimension:      XYZ
bbox:           xmin: -179.875 ymin: -78.375 xmax: 179.875 ymax: 89.875
epsg (SRID):    4326
proj4string:    +proj=longlat +datum=WGS84 +no_defs
> object.size(r)
438817848 bytes


On 4/12/19 12:48 AM, Barry Rowlingson wrote:
> QGIS could "read" it pretty smartly, only loading in the bits in the
> current view extent, and doing the loading in a separate thread so the
> GUI was still active.
> 
> Marta has told me that she only needs the surface layer points - the X Y
> and Z coordinates are duplicated as attributes so I think a selection of
> Z=0 (or something) might make a small enough subset to read into R
> directly. This might be doable via the `query` option of `st_read`, or
> failing that a "select" in SQLite3 and dumping the results to a CSV
> file. There seems to be hundreds of data points at each location so
> taking the surface points only could thin it out considerably. It may
> still take some time but if its a one-off...
> 
> Barry
> 
> 
> On Thu, Apr 11, 2019 at 9:57 PM Edzer Pebesma
> <edzer.pebesma using uni-muenster.de <mailto:edzer.pebesma using uni-muenster.de>>
> wrote:
> 
>     It's a 30 Gb 3D point file:
> 
>     $ ogrinfo EMU.gpkg
>     INFO: Open of `EMU.gpkg'
>           using driver `GPKG' successful.
>     1: EMU_Master (3D Point)
> 
>     @Shaun: homebrew seems to be supported neither by apple, nor by CRAN, so
>     you are a bit on your own there. Have you tried the CRAN binary packages
>     using GDAL?
> 
>     In any case, the windows binary does (should) support gpkg, see
>     https://github.com/rwinlib/gdal2
> 
>     Trying to read this file into R with sf::st_read will require a lot of
>     RAM, or some strategy to read in parts only.
> 
>     On 4/11/19 5:52 PM, Shaun Walbridge wrote:
>     > I think the issue is, most GDAL installations don't have the
>     Geopackage raster driver [1] installed by default, which lists
>     "Needs libsqlite3 (and any or all of PNG, JPEG, WEBP drivers)" for
>     it to be available. At least on my Homebrew installation of GDAL,
>     this driver wasn't built out of the box. If you rebuild GDAL with
>     this additional driver, or find a prebuilt binary which has it, it
>     should be able to open. A simple test is if `gdalinfo EMU.gpkg`
>     returns information about the dataset outside of R.
>     >
>     > 1.
>     https://urldefense.proofpoint.com/v2/url?u=https-3A__www.gdal.org_drv-5Fgeopackage-5Fraster.html&d=DwIGaQ&c=n6-cguzQvX_tUIrZOS_4Og&r=fCPRb7QX-vd5bnO9gIJHCiX852SVUtyYX--xtCKtpfk&m=p5ULiF5de1gKZBP-IzWbMO9Pe5LFzv9uaZ5VJYnWw1Y&s=d6xaKGlN0jpd8mBdjKXAhzst7N3Bgo43BvJlLnDSngk&e=
>     >
>     > On 4/11/19, 11:41 AM, "Barry Rowlingson" <b.rowlingson using gmail.com
>     <mailto:b.rowlingson using gmail.com>> wrote:
>     >
>     >     What did you try? The instructions at the top say:
>     >     
>     >     "Download 3.3GB tile package and rename extension from .tpk to
>     .zip.
>     >     Extract to get EMU.gpkg"
>     >     
>     >     If that's a valid GeoPackage then `sf` should be able to read
>     it. Not sure
>     >     what might be in the geopackage though, "tile package" sounds
>     like rasters,
>     >     but GeoPackages are generally vector...
>     >     
>     >     I'll try in five minutes when all 3.3Gb have downloaded....
>     >     
>     >     On Thu, Apr 11, 2019 at 3:37 PM Marta Rufino
>     <marta.m.rufino using gmail.com <mailto:marta.m.rufino using gmail.com>>
>     >     wrote:
>     >     
>     >     > Hi,
>     >     >
>     >     > I would like to open (and use) a 'tpk' file from arcgis in r.
>     >     > For example:
>     >     >
>     >     >
>     https://esri.maps.arcgis.com/home/item.html?id=24885cd6bd9544f5a8e15d0bf40f67d6
>     >     >
>     >     > I tried raster and sf package, but no luck.
>     >     >
>     >     > Any ideia if we can do this in r?
>     >     >
>     >     > Thank you very much in advance,
>     >     >
>     >     > Best wishes,
>     >     > M.
>     >     >
>     >     >         [[alternative HTML version deleted]]
>     >     >
>     >     > _______________________________________________
>     >     > R-sig-Geo mailing list
>     >     > R-sig-Geo using r-project.org <mailto:R-sig-Geo using r-project.org>
>     >     >
>     https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_r-2Dsig-2Dgeo&d=DwICAg&c=n6-cguzQvX_tUIrZOS_4Og&r=YFaRLkcUCdDkLrpTbNOUV9J1CwYBCTMwgm5tdQkRSm4&m=nytIIxO936Ls0xrd3zZkBd1WNjQB3DwlOK88GErq19M&s=uahwJjXmsZFnUVQXvkICr3EfAbNjOuaXl6iwziIexTM&e=
>     >     >
>     >     
>     >       [[alternative HTML version deleted]]
>     >     
>     >     _______________________________________________
>     >     R-sig-Geo mailing list
>     >     R-sig-Geo using r-project.org <mailto:R-sig-Geo using r-project.org>
>     >   
>      https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_r-2Dsig-2Dgeo&d=DwICAg&c=n6-cguzQvX_tUIrZOS_4Og&r=YFaRLkcUCdDkLrpTbNOUV9J1CwYBCTMwgm5tdQkRSm4&m=nytIIxO936Ls0xrd3zZkBd1WNjQB3DwlOK88GErq19M&s=uahwJjXmsZFnUVQXvkICr3EfAbNjOuaXl6iwziIexTM&e=
>     >     
>     >
>     >
>     > _______________________________________________
>     > R-sig-Geo mailing list
>     > R-sig-Geo using r-project.org <mailto:R-sig-Geo using r-project.org>
>     > https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>     >
> 
>     -- 
>     Edzer Pebesma
>     Institute for Geoinformatics
>     Heisenbergstrasse 2, 48151 Muenster, Germany
>     Phone: +49 251 8333081
>     _______________________________________________
>     R-sig-Geo mailing list
>     R-sig-Geo using r-project.org <mailto:R-sig-Geo using r-project.org>
>     https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> 

-- 
Edzer Pebesma
Institute for Geoinformatics
Heisenbergstrasse 2, 48151 Muenster, Germany
Phone: +49 251 8333081

-------------- next part --------------
A non-text attachment was scrubbed...
Name: pEpkey.asc
Type: application/pgp-keys
Size: 2472 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20190412/f40f9f2b/attachment.bin>


More information about the R-sig-Geo mailing list