[R-sig-Geo] shapefiles plotting and colouring

Paolo Cavallini cavallini at faunalia.it
Fri Oct 31 18:27:56 CET 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Thanks for this. My problem is, however, to use variables from a database 
(PostgreSQL in our case) rather than those of the dbf associated with the shp 
file.
All the best.
Paolo

At 18:03, venerdì 31 ottobre 2003 you presumably wrote:
> Hi.
>
> I've tried to draw choropleth maps by rmap package as follows.
>
> library(rmap)
>
> mySF <- shapefile("columbus.shp")
>
>  crime <- mySF$CRIME
>
> # user-defined legend
>  classes <- c(50,100,500,1000,5000)
>  breaks <- length(classes) + 1
>  classNo <- crime < classes[1]
>  for(i in 1:(breaks - 1))
>    classNo <- classNo + (crime >= classes[i] & crime < classes[i + 1]) * i
>
>  classNo <- classNo + (crime >= max(classes)) * breaks
>  plot(mySF, f=gray(1 - classNo/breaks)) # draw map
>  lines(mySF, col="red") # draw outlines
>
> ----- Original Message -----
> From: "Paolo Cavallini" <cavallini at faunalia.it>
> To: <r-sig-geo at stat.math.ethz.ch>
> Sent: Friday, October 31, 2003 11:57 PM
> Subject: [R-sig-Geo] shapefiles plotting and colouring
>
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> >
> > Hi all.
> > it may be a silly question, but: how can I, after reading a shapefile
> > with
>
> the
>
> > appropriate library, draw them with different colours (or grey shades)
> > according to different database fields (read through RODBC)? The idea is
> > similar to the polygon command, but using shp as polygons and database
>
> fields
>
> > as qualifiers.
> > Thanks for any suggestions.
> > Ciao.
> > paolo

- -- 
Paolo Cavallini
cavallini at faunalia.it
www.faunalia.it
Piazza Garibaldi 5
56025 Pontedera (PI)
Italy
Tel: (+39)348-3801953
GPG signature/firma digitale @:
www.faunalia.it/Public_key_Paolo.asc
- ------------------------------------------
Lavoro esclusivamente con software libero.
I use exclusively free software.
www.gnu.org / www.linux.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQE/opuc/NedwLUzIr4RApSMAJoCktLlzZVBfzStI09vsNKScgDk4wCdHNz8
+HhE2grymbl4Z5S84M2Fwgo=
=4H68
-----END PGP SIGNATURE-----




More information about the R-sig-Geo mailing list