Skip to content
Prev 59363 / 398502 Next

adjusting the map of France to 1830

At 19:07 18/11/2004, Ray Brownrigg wrote:
There is the gpclib package which computes intersection, union... of 
polygons. I have try to play with its union function and the france data, 
but the results are good but a little bit complicate:
# i merge the two firts polygons:

 > departements=map('france')
 > which(is.na(departements$x))[1:2]
   [1]   66  122
 > gpcA <- as(cbind(departements$x[1:65],departements$y[1:65]),"gpc.poly")
 > gpcB <- as(cbind(departements$x[67:121],departements$y[67:121]),"gpc.poly")
 > union(gpcA,gpcB)
GPC Polygon
    Num. Contours:  1
    Num. Vertices:  74
    BBox (X):  1.563161 --> 4.225965
    BBox (Y):  49.97212 --> 51.09752
 > gpcAB<-union(gpcA,gpcB)


 > 
departements$x=c(attr(gpcAB,"pts")[[1]]$x,attr(gpcAB,"pts")[[1]]$x[1],departements$x[-(1:121)])
 > 
departements$y=c(attr(gpcAB,"pts")[[1]]$y,,attr(gpcAB,"pts")[[1]]$y[1],departements$y[-(1:121)])
 > map(departements)


Another solution is to do the job in a GIS and to import the new map with 
maptools.

The package gpclib is very intersting and I think that it can be used to 
develop some basic GIS tools. I have write a functions to compute 
intersections for objects of class polys easily.

The only thing is to know for which class of spatial objects these 
functions must be developed !



St??phane DRAY
-------------------------------------------------------------------------------------------------- 

D??partement des Sciences Biologiques
Universit?? de Montr??al, C.P. 6128, succursale centre-ville
Montr??al, Qu??bec H3C 3J7, Canada

Tel : (514) 343-6111 poste 1233         Fax : (514) 343-2293
E-mail : stephane.dray at umontreal.ca
-------------------------------------------------------------------------------------------------- 

Web                                          http://www.steph280.freesurf.fr/