[R-sig-Geo] tpk files

Barry Rowlingson b@row||ng@on @end|ng |rom gm@||@com
Fri Apr 12 19:33:38 CEST 2019


On Fri, Apr 12, 2019 at 6:16 PM Marta Rufino <marta.m.rufino using gmail.com>
wrote:

> Hi,
>
> Now, the next issue will be how to transform the huge world wide sf points
> (that are actually 32 classes) into a 'multipolygons' sf. Maybe I should do
> a new post with a reproducible example for this new challenge, if I don't
> manage (tried st_cast to LINESTRING and POLYGON and rasterToPolygons but no
> luck).
>
>
 You might be able to polygonize the raster version of the data using
rasterToPolygons (it returns sp class polygons but they can be converted).

...yup - starting with the raster I constructed previously:

takes a couple of minutes....

> rdpoly = rasterToPolygons(rdraster,dissolve=TRUE)
Loading required namespace: rgeos
> rdpoly
class       : SpatialPolygonsDataFrame
features    : 32
extent      : -180, 180, -78.5, 90  (xmin, xmax, ymin, ymax)
coord. ref. : NA
variables   : 1
names       : layer
min values  :     1
max values  :    32
> plot(rdpoly)
> spplot(rdpoly,"layer")

and you'll have to run it yourself to see the results!

 Feel free to share my SQL scripts and other bits of code.

Barry



> So, thank you once again,
> Good weekend,
> Cheers,
> M.
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list