[R-sig-Geo] shapefiles, images, iimagemaps, and removing internalboundary lines
Roger Bivand
Roger.Bivand at nhh.no
Thu Oct 19 18:14:01 CEST 2006
On Thu, 19 Oct 2006 matt.pettis at thomson.com wrote:
> Hi Roger,
>
> Thanks again for the response. To answer your questions:
>
> - I am currently running on R 2.3.1. I was at 2.4.x, but some of the
> packages I thought I needed weren't available on the cran interface in
> the rgui (I was experimenting, and I can't remember what they were now,
> so that may no longer be true). It sounds like you are fine running R
> at 2.4, though, and I could probably upgrade, as my sole purpose for
> having R right now is to deal with shapefiles and create image maps.
>
> - Related to the above, I don't see the spgpc package on my mirror (USA
> (IA)), but that may be related to being at 2.3?
No, but it isn't on CRAN, only on the little sp extras repository on
sourceforge:
rSpatial <- "http://r-spatial.sourceforge.net/R"
install.packages("spgpc", repos=rSpatial)
so this should install it. In fact there isn't yet a Windows binary for
2.4, so 2.3 is OK.
>
> Also, I saw the 'unionSpatialPolygons' command in Debarchana Ghosh's
> code, but didn't know what it did. I'll investigate the paths you have
> listed here.
>
> Thanks again,
> Matt
>
> -----Original Message-----
> From: Roger Bivand [mailto:Roger.Bivand at nhh.no]
> Sent: Thursday, October 19, 2006 2:32 AM
> To: Pettis, Matthew (TLR Corp)
> Cc: r-sig-geo at stat.math.ethz.ch
> Subject: Re: [R-sig-Geo] shapefiles, images, iimagemaps, and removing
> internalboundary lines
>
> On Wed, 18 Oct 2006 matt.pettis at thomson.com wrote:
>
> > I have sucessfully inputted a shapefile into a
> > SpatialPolygonsDataFrame object. I would like to output this file as
> > a .gif/.png/.bmp/.jpeg image and generate an imagemap for the
> > outputted image. Does anybody know the best way to approach this?
>
> RSiteSearch("imagemap")
>
> gets you to:
>
> http://finzi.psych.upenn.edu/R/Rhelp02a/archive/28035.html
>
> This installs on R 2.4.0 from source - which platform are you using and
> can you install source packages? The documentation in
> imagemap/inst/doc/imagemap-howto.pdf is clear, addRegion(im) <- for each
> clickable object. How to go from there depends on what you want to be
> clickable.
>
> Alternatives might be Rpad:
>
> http://finzi.psych.upenn.edu/R/Rhelp02a/archive/77952.html
>
> or using ogr2ogr in FWTools (external software) to generate a KML for
> Google Earth (if the bubble that pops up is enough - I don't know how to
> put a link into it, though I guess it could be done), or writing the KML
> from R:
>
> http://bbs.keyhole.com/ubb/showflat.php/Cat/0/Number/221682/Main/219131
>
> > secondly (and i may need to start another thread for this), but is
> > there an easy function to remove the interior lines of aggregated
> > shapes (and generate an imagemap again, etc.)? For example, If I have
>
> > a map of the U.S.'s with a polygon for each state, could I remove all
> > internal state boundaries to leave just the national border?
>
> Using the objects you have now, you need to install the spgpc package:
>
> rSpatial <- "http://r-spatial.sourceforge.net/R"
> install.packages("spgpc", repos=rSpatial)
>
> and install gpclib from CRAN. Then
>
> ?unionSpatialPolygons
>
> to dissolve internal boundaries. This is for arbitrary polygons, if you
> really just need to dissolve US states, perhaps using the CRAN maps
> package with its built-in database, and its own dissolve mechanism would
> save re-doing topology, but it only works for polygons in the database.
>
> Roger
>
> >
> > thanks,
> > Matt
> >
> > _______________________________________________
> > 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
>
--
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