[R-sig-Geo] [R] Plot/manage spatial boundary data

Roger Bivand Roger.Bivand at nhh.no
Fri Jun 10 23:25:26 CEST 2005


On Fri, 10 Jun 2005, David Forrest wrote:

> On Fri, 10 Jun 2005, Roger Bivand wrote:
> ...
> > > The segments are largely connected -- my domain is bounded by a list of
> > > open boundary segments, land boundary segments, and several islands.
> > > library(sp) looks like the proper tool.
> >
> > If you can identify the open segments, and make Sline objects of them,
> > you'll get the bounding box too (bbox() of the output object). That gives
> > you the coordinates you need to close them against the study area boundary
> > (assumed rectangular in latlong), by rbind() to the input coordinates for
> > the missing bits, and copy in coords[1,] at the end to close. Since the
> > islands are closed rings anyway, I think this should work. Please let us
> > know how you get on.
> >
> > Roger
> 
> Thanks,
>   I'm poking around my data to see what is my boundary lists
> 
> http://www.maplepark.com/~drf5n/cgi-bin/wiki.cgi?ElcircVisualization has
> an old sample dataset (in UTM zone 18?) (and the boundary information is
> missing in that old sample file).
> 
> On a more current output file, (with a proprietary FEM grid) it looks like
> only one of the 27 boundaries are closed, and that may be accidental.
> Boundary segment 0 is the ocean open-boundary condition, and when appended
> to boundary segment 27, the Chesapeake Bay coastline, it forms a closed
> loop around my model domain.
> 
> http://www.maplepark.com/~drf5n/cgi-bin/wiki.cgi?ElcircVisualization
> 
> has a few of my boundary extractor functions.
> 
> At this point, I have a closed boundary surrounding my domain, and 3 time
> series of spatial fields defined at node points that I can index into my
> geom[] dataframe.
> 
> I'm really not experienced in GIS, but a product I would like to make
> from this data is a plot of the water height or surface current vectors
> at a set of times.  As the plot on the page referenced above shows, I'm
> not sure what to do next.
> 
> I'd like to mask off the coastline, plot either a selection of my node
> points or interpolate onto a regular grid within the polygon, not
> interpolate across the dirt, and use R to visualize the results of my
> model.
> 
> I saw http://r-spatial.sourceforge.net/gallery/ , and the code there looks
> like it could help.  I'll dig into that.

I think that the overlay() methods there will help once the polygons are 
constructed, the SpatialPixels* classes would be the ones to try to reach 
(a grid with the NA grid cells dropped). I'm not sure of the next steps 
either, probably once a SpatialRings object can be plotted, then 
overlaying on the grid you are making for interp() should move things 
along. 

> 
> Meanwhile, which text should I buy and read?
> 

For now the source code is the best reference, there is some documentation 
on sourceforge (the gallery figures all have code), and this discussion 
will be in the list archives for the next researcher with similar needs!

Best wishes,

Roger


> Thanks for your time,
> Dave
> 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no




More information about the R-sig-Geo mailing list