user1672610
user1672610

Reputation: 19

convert loess to spatial data

I am completely at loss on how to convert from atomic vectors, lists, etc. to spatial data.

I want to work with data in polygons on a map (nxm matrix). Specifically the output from functions such as loess and akima. For example from loess I get: List of 3

 $ x: num [1:112] 656977 657024 657071 657118 657165 ...
 $ y: num [1:82] 661500 661544 661587 661631 661675 ...
 $ z: num [1:112, 1:82] -725 -724 -720 -715 -707 ...

where x and y a State Plane Coordinates, and z is a combination of land surface and bathymetry elevations. The bathymetry is inside a polygon and some of the loess results spill outside of the polygon onto the matrix. I want to zero out everything out side of the polygon. I believe I can do that with over, but the data needs to be a spatial coordinates.

How do I do that? I have been searching and trying things out for weeks.

Thanks in advance...

Upvotes: 0

Views: 198

Answers (2)

John
John

Reputation: 23758

Assuming you could do a traditional loess with a single predictor and plot it...

A two way interaction can be thought of as occurring on a two dimensional plane. Therefore, simply providing x and y as interaction terms you should be able to plot your loess function using some three dimensional system, even if it is just as the predicted z-values being levels in a heat plot.

Upvotes: 0

Ari B. Friedman
Ari B. Friedman

Reputation: 72731

It's a pretty broad question so here are hints and pointers rather than specifics.

R has many types of spatial classes, but things over the past few years have converged to the Spatial___DataFrame classes of library sp.

The Bivand Applied Spatial Analysis with R book has a detailed set of examples and examination of the internals, including how to create them and how to convert between various spatial classes.

There's also a Spatial vignette to help gt you started.

Upvotes: 1

Related Questions