[R-sig-Geo] How to convert results generated by "filled.contour" to shapefiles?

Roger Bivand Roger.Bivand at nhh.no
Fri Sep 12 10:10:55 CEST 2008


On Fri, 12 Sep 2008, Hisaji ONO wrote:

> Hello.
>
> Currently I have developed geo-spatial mining tool using
> R with spdep, spgwr and other packages as
> OpenJUMP(http://www.openjump.org)'s plug-ins.
>
> I've already implemented contouring function using
> contourlines function.
>
> I'd like to fill colours between levels of contours.
>
> So does anyone try to convert results generated by
> "filled.contour" to shapefiles?

The filled.contour() is a different kind of function, essentially doing 
almost everything in C, and passing nothing back. So I think the only 
alternative is to build polygons from the contourLines() output by 
intersecting with a bounding box, and then finding out which polygon 
boundaries are the ones needed and which attribute interval should be 
associated with them.

My feeling would be that this kind of computational geometry might best be 
done outside R, though a lot can now be done with functions in spatstat 
and gpclib/PBSmapping. Alternatively, look at src/main/plot3d.c and check 
how the internals build their polygons. Returning them is hard - for 
contourLines I worked with Paul Murrell to expose the geometry in the way 
that it is now done - perhaps the same could be applied to 
filled.contours()?

>
> Could you share the knowledge?
>
>
> Regards.
>
> P.S.
>
>  I have received "Applied Spatial Data Analysis with R
> (Use R) " from Amazon Japan.
>
> It's very nice and useful book. Thanks.

Thanks! It's good to hear that copies have started arriving. We (the 
authors) would be grateful if anyone can tell us (preferably off-list!) of 
things that are wrong, so that we can put them in the errata on the 
website.

Best wishes,

Roger

>
> _______________________________________________
> 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, 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