Skip to content

shapefiles, images, iimagemaps, and removinginternalboundarylines

6 messages · matt.pettis at thomson.com, Barry Rowlingson, Roger Bivand

#
Thanks Roger,

I'll try and build my own from source -- I was just hoping there was a
binary floating around somewhere.

Truthfully, my maps will have very detailed boundaries (Relatively
speaking, I think), so I'll give it a try.

I'll be posting some more questions in a bit about
'unionSpatialPolygons', as I am having some troubles with it...

Thanks,
Matt 

-----Original Message-----
From: Roger Bivand [mailto:Roger.Bivand at nhh.no] 
Sent: Thursday, October 19, 2006 2:57 PM
To: Pettis, Matthew (TLR Corp)
Cc: r-sig-geo at stat.math.ethz.ch
Subject: RE: [R-sig-Geo] shapefiles, images, iimagemaps, and
removinginternalboundarylines
On Thu, 19 Oct 2006 matt.pettis at thomson.com wrote:

            
The *.tar.gz is a source package. The *.zip are typically Windows binary
packages, pre-built. Some Windows users with programming experience do
build their own from source, the toolset is described in Appendix E of
the R Installation and Administration manual, and package installation
in Ch. 
6. If that isn't for you (or anybody nearby), say, and someone may have
a go at building a Windows binary. Whether it is worth the trouble for
spatial objects will however depend on the objects you want to make
clickable, if they are simple, it'll work, but if they are polygons with
very detailed boundaries (remember that the image map is raster while
the boundaries are vector), it may not scale well. Probably worth
trying, though.

Roger
package:
--
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
#
matt.pettis at thomson.com wrote:
Matt,
   my imagemap package is all R code - if you can extract the .tar.gz 
file (ask a friendly local linux user to do it, or install cygwin) then 
you just need to source the .R files.

  Okay, I've zipped this up here:

http://www.maths.lancs.ac.uk/Software/Imagemap/imagemap.zip

  note this is probably *not* an installable package. Unzip it, then 
source() the .R file. Also, it was designed for R 1.8.x, and R has moved 
on so things may have changed and not work anymore. Someone could 
probably easily build a windows .zip package for installation...

Barry
#
Thanks Baz! I'll give it a go...
 
Matt

________________________________

From: Baz [mailto:B.Rowlingson at lancaster.ac.uk]
Sent: Thu 10/19/2006 4:56 PM
To: Pettis, Matthew (TLR Corp)
Cc: Roger.Bivand at nhh.no; r-sig-geo at stat.math.ethz.ch
Subject: Re: [R-sig-Geo] shapefiles, images, iimagemaps, and removinginternalboundarylines
matt.pettis at thomson.com wrote:
Matt,
   my imagemap package is all R code - if you can extract the .tar.gz
file (ask a friendly local linux user to do it, or install cygwin) then
you just need to source the .R files.

  Okay, I've zipped this up here:

http://www.maths.lancs.ac.uk/Software/Imagemap/imagemap.zip

  note this is probably *not* an installable package. Unzip it, then
source() the .R file. Also, it was designed for R 1.8.x, and R has moved
on so things may have changed and not work anymore. Someone could
probably easily build a windows .zip package for installation...

Barry
#
On Thu, 19 Oct 2006, Baz wrote:

            
Ran for me installed from source package on 2.4.0.

Roger

  
    
#
On Thu, 19 Oct 2006 matt.pettis at thomson.com wrote:

            
A possible dirty fix is to overlay the polygons with a low-resolution grid 
and take the convex hull of cell centres within each polygon as the object 
passed to the HTML code as a clickable mask - there will be "no-hit" 
slivers, and overlaps for convex/concave boundaries, but life is too short 
...

library(maptools)
xx <- readShapePoly(system.file("shapes/sids.shp", package="maptools")[1], 
  IDvar="FIPSNO", proj4string=CRS("+proj=longlat +ellps=clrk66"))
grd <- GridTopology(c(-84.5, 33.75), c(0.025, 0.025), c(360, 120))
mask <- SpatialGrid(grd, proj4string=CRS("+proj=longlat +ellps=clrk66"))
where <- overlay(mask, xx) # takes some time
incrds <- coordinates(mask)[!is.na(where),]
inwhere <- where[!is.na(where)]
incrds1 <- split(data.frame(incrds), inwhere)
chulls <- lapply(incrds1, function(x) {xx <- as.matrix(x); 
  xx[chull(xx),]})
plot(xx, border="blue")
lapply(chulls, polygon, col="yellow")

There are slivers/overlaps, it'll need fine tuning, but these image map 
polygons have many fewer boundary points that the originals. In addition 
multiple polygon objects are not treated gracefully. 

Roger

  
    
#
On Fri, 20 Oct 2006, Roger Bivand wrote:

            
After thinking abour using imagemaps, I realised that this will probably 
not scale with regard to the client-side/server-side balance. I really 
recommend looking at Rpad, and at MapServer for an open-source way of 
keeping relatively little on the client side. The harder bits are moving 
the data in the data base tables into R and back again maintaining the 
correct keys, but I'm sure it can be done. Apart from Rpad, are there 
others on the list with experience of using R as middleware for processing 
attribute data for web mapping? The O'Reilly "Web Mapping Illustrated" 
by Tyler Mitchell has plenty of ideas, but I can't see that they use R.

Roger