[R] map and shapefile help

Michael Sumner mdsumner at gmail.com
Sun Apr 1 10:09:29 CEST 2012


There is no coordinate system defined for these files- proj4string is
NA, see below - otherwise transforming them to that used by the maps
package is trivial. I suggest you find out the coordinate system from
the provider of the data and ask any further questions on R-Sig-Geo.
This is a big file, ~34 Mb and you should warn people of that.

library(maptools)
x <- readShapeSpatial("NA_CEC_Eco_Level3.shp")

 summary(x)
Object of class SpatialPolygonsDataFrame
Coordinates:
       min     max
x -4334052 3324076
y -3313739 4267265
Is projected: NA
proj4string : [NA]
Data attributes:
   NA_L3CODE                                           NA_L3NAME
 8.5.2  : 217   Mississippi Alluvial Plain                  : 217
 7.1.5  : 208   Coastal Western Hemlock-Sitka Spruce Forests: 208
 8.5.1  : 163   Middle Atlantic Coastal Plain               : 163
 8.5.3  : 147   Southern Coastal Plain                      : 147
 2.1.5  : 135   Foxe Uplands                                : 135
 8.1.8  :  98   Acadian Plains and Hills                    :  98
 (Other):1580   (Other)                                     :1580
...



On Sun, Apr 1, 2012 at 4:55 PM, Michael Sumner <mdsumner at gmail.com> wrote:
> Try the R-Sig-Geo mailing list for a better target community, but if these
> are shapefiles there is read support in rgdal (or maptools for a simpler
> alternative) and if these are in long-lat like the maps package then plot(x,
> add=TRUE) will be most of the way there.
>
> If you need to transform either layer then see spTransform or project in
> rgdal.
>
> Cheers, Mike
>
>
> On Sunday, April 1, 2012, chuck.01 wrote:
>>
>> Hi,
>> I want to use map("state") and have the ecoregion shape (please see link)
>> file projected onto this.
>>
>> ftp://ftp.epa.gov/wed/ecoregions/cec_na/NA_CEC_Eco_Level3.zip
>> ftp://ftp.epa.gov/wed/ecoregions/cec_na/NA_CEC_Eco_Level3.zip
>>
>> Could someone please show me how; I have never messed with this sort of
>> thing.
>> Thanks.
>>
>> --
>> View this message in context:
>> http://r.789695.n4.nabble.com/map-and-shapefile-help-tp4522794p4522794.html
>> Sent from the R help mailing list archive at Nabble.com.
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
>
>
> --
> Michael Sumner
> Institute for Marine and Antarctic Studies, University of Tasmania
> Hobart, Australia
> e-mail: mdsumner at gmail.com



-- 
Michael Sumner
Institute for Marine and Antarctic Studies, University of Tasmania
Hobart, Australia
e-mail: mdsumner at gmail.com



More information about the R-help mailing list