[R-sig-Geo] 3D KDE to Triangular Irregular Network

Andrew Duff andrewaduff at gmail.com
Sat Apr 13 07:31:52 CEST 2013


Thanks a lot Michael that was very helpful.  It seems like you might be able
to make a TIN from one of the contour levels, say 75% or something.  I'm not
really sure how to get to those isosurface vertex coordinates for a given
contour level.  Is that possible in R.

-----Original Message-----
From: r-sig-geo-bounces at r-project.org
[mailto:r-sig-geo-bounces at r-project.org] On Behalf Of Michael Sumner
Sent: Friday, April 12, 2013 2:06 PM
To: Duff, Andrew A (DFW)
Cc: r-sig-geo at r-project.org
Subject: Re: [R-sig-Geo] 3D KDE to Triangular Irregular Network

A TIN cannot represent that data structure, the plot shows multiple surfaces
that wrap around in 3D. (A TIN cannot do that). The plot is made by
"contouring" (isosurfaces) from a 3D array.

You can represent the array in NetCDF, and maybe your GIS can read that.
Otherwise you could do the same as here but create a 2D raster for every
slice in the 3rd dimension and reconstruct over there.

Bare bones using raster to NetCDF:

library(raster)
r <- brick(UD$estimate, xmn = min(UD$eval.points[[1]]), xmx =
max(UD$eval.points[[1]]),
  ymn = min(UD$eval.points[[2]]), ymx = max(UD$eval.points[[2]]))

## Plot each 3D slice
plot(r)

## write to NetCDF, you need ncdf or ncdf4 package writeRaster(r, "file.nc")

See ?writeRaster for further options to add descriptors to the file, and you
will likely need to worry about the orientation when making the raster
object.



On Sat, Apr 13, 2013 at 4:29 AM, Duff, Andrew A (DFW) <
Andrew.Duff at dfw.wa.gov> wrote:

> I am interested in being able to export the results of a 3 dimensional 
> kernel density estimate from the ks package in R to a format that 
> could be viewed in 3D GIS application such as ESRI's ArcScene or 
> ArcGlobe.  I want to example the use of airspace in relation to 
> terrain features.  A TIN seems to be the most logical geospatial data 
> structure that would support taking the 3D kde output into GIS.  Does 
> anybody have any ideas on how to get from a 3D kde output in ks to a 
> tin.  A self-contained sample of generating the kde is below.
>
> ###sample
> library(ks)
> df <- data.frame("x"=sample(1:200, 10), "y"=sample(1:200, 10), 
> "z"=sample(1:500, 10))
> Hpi1 <- Hpi(x = df)
> UD <- kde(x=df, H=Hpi1)
> plot(UD)
>
> Thanks in advance.
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>



--
Michael Sumner
Hobart, Australia
e-mail: mdsumner at gmail.com

	[[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo at r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo



More information about the R-sig-Geo mailing list