# convert Map shapes to logical matrices - for setoperations

 Classic List Threaded
1 message
Reply | Threaded
Open this post in threaded view
|

## convert Map shapes to logical matrices - for setoperations

 Administrator On Tue, 7 Dec 2004, James Muller wrote: > Hi, I have a little problem.  (and sorry for the cross-post of this) > > I'm trying to do the following: >  Convert  _projected_ shapes from a Map object into logical matrices. > That is, rasterize a shape into a logical "in-the-shape" and > "out-of-the-shape" matrix. > > What I'm trying to do is get an 'equal-area' estimate of the area of > intersection between two overlapping shapes, without any concern about > there being holes in the shapes. I know owin can deal with most of this, > but for sure it doesn't support geographic projections, which will allow > the 'equal-area' estimate to be equal. > > An idea I had was to pipe the output of the maptools Map plotting > function map into the matrix. But I really have no idea how to do that > at this point in my R education. Do you have Shapes from the Map object in lat-long or projected coordinates? If they are in projected coordinates, you can generate a grid with the standard function expand.grid() and then use a point-in-polygon function, such as inside.owin() or similar, on each of the grid points. If your shape polygons are in geographical coordinates, then consider projecting them, see http://www.remotesensing.org/proj for open source projection software. You would then be looking for grid points in A, and among those, grid points in B, I think. I don't think I'd want to have to generate equal area grid points in lat-long, though you could do that using proj inversely. Roger > > Any suggestions are extremely welcome. > > Cheers, > > James > > _______________________________________________ > R-sig-Geo mailing list > R-sig-Geo at stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/r-sig-geo> -- Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Breiviksveien 40, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93 e-mail: Roger.Bivand at nhh.no Roger Bivand Department of Economics Norwegian School of Economics Helleveien 30 N-5045 Bergen, Norway