[R-sig-Geo] Re: Reading and projecting lat/long point coordinates using R?

Anthony Westerling leroy at ucsd.edu
Thu Mar 31 16:54:47 CEST 2005


If you want a base map to add your polygons to, you can use the Maps 
package in R, or plot a map from a shapefile or arcinfo coverage using 
Rmap or maptools libraries (for shapefile format) or RArcInfo (for e00 
or avc formats) in R.  To add your polygons to the figure just use 
polygon().  If you need to reproject the coordinates in your polygons 
you can use mapproject() in the mapproj library or project() in Rmap(). 
  I prefer project() (it can convert from a projection to geographic 
coordinates (ie, lat/lon), while I think mapproject() just takes 
geographic coordinates) but mapproject() has more documentation.  Both 
use proj4 library (libproj), so you will need to install that.  To use 
shapefiles you need libshp.

I think Rmap is still not distributed via CRAN.  You can find it at 
http://www.maths.lancs.ac.uk/Software/Rmap/

I've linked the documentation for the proj4 library to Barry 
Rowlingson's Rmap documentation, which can be useful when you are 
re-projecting coordinates.  If you want it,  the zipped html files are 
~9 MB.  The original sources are on the web of course.

areapl() in the splancs library can calculate the area of a polygon.

Anthony L. Westerling
Climate Research Division
Scripps Institution of Oceanography
University of California, San Diego
858 822 4057
leroy at ucsd.edu

> Date: Wed, 30 Mar 2005 11:42:17 -0800
> From: "Rick Reeves" <reeves at nceas.ucsb.edu>
> Subject: [R-sig-Geo] Reading and projecting lat/long point coordinates
> 	using	R?
> To: <r-sig-geo at stat.math.ethz.ch>
> Message-ID: <000001c53560$9484c970$8bdc6f80 at BURAN>
> Content-Type: text/plain;	charset="us-ascii"
>
>
>
> Hello:
>
> I've searched the literature, havent found an answer, so here goes?
>
> We have a set of polygon features defined as a series of unprojected
> vertices represented by lat/long pairs, in an ASCII-format file.
>
> We need to display (on a map-like plot) and then calculate the areas
> of the polygons, and would like to do this entirely within R if
> possible.
> Is there a map projection package for R? Or, has anyone solved this
> or a related problem using R? I could do this with the MATLAB mapping
> toolbox, but prefer to use R if possible....
>
>
> Thanks,
>
> Rick Reeves
>
> Scientific Programmer / Quantitative Analyst
> National Center for Ecological Analysis and Synthesis
> University of California, Santa Barbara
> 805 892 2534
> reeves at nceas.ucsb.edu
>
>
>
> ------------------------------
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
>
> End of R-sig-Geo Digest, Vol 19, Issue 15
> *****************************************
>




More information about the R-sig-Geo mailing list