[R-sig-Geo] R-sig-Geo Digest, Vol 104, Issue 1
Roger Bivand
Roger.Bivand at nhh.no
Sun Apr 1 16:48:48 CEST 2012
On Sun, 1 Apr 2012, John Ortiz wrote:
>
>> I am trying to use this thread to import coastlines into R, however i am not
>> succeeding:
>>
>> When I try(with latest version of maptools and psbmapping just installed):
>>
>> a) wcoastline <- read.shp("C:/Users/Agus/Desktop/Distributional range
>> size/GSHHS_shp/gshhs_land.shp")
>> I get
>> Error: could not find function "read.shp"
>
> To use the function "read.shp" you must to install the "shapefiles" packages
>
> http://rss.acs.unt.edu/Rdoc/library/shapefiles/html/shapefiles.html
>
> Otherwise, you can use the function "readShapeSpatial" from maptools packages to import
> your shapefile.
Yes, if you want to read the shapefile version of the shorelines, use
readOGR() in rgdal. However, note that the shapefile may be very large
indeed, and that your choice of shapefile to use by resolution should be
guided by your needs.
>
> http://hosho.ees.hokudai.ac.jp/~kubo/Rdoc/library/maptools/html/readShapeSpatial.html
>
>>
>> b) coastline=importGSHHS("C:/Users/Agus/Desktop/Distributional range
>> size/GSHHS_shp/gshhs_land.shp"
>> , xlim=c(envir at extent@xmin,envir at extent@xmax),
>> ylim=c(envir at extent@ymin,envir at extent@ymax))
>>
>> I get:
>>
Please always say which packages are involved. Here you omitted to say
that this is PBSmapping. If you read the manual page, you will see that it
is not for reading the shapefile version, but the GSHHS binary version,
which is available in a selection of resolutions. This function reads into
the PolySet object format. If you prefer the more general classes defined
in the sp package, use Rgshhs() or the wrapper function getRgshhsMap() in
maptools, also using binary GSHHS files. Choose your resolution and
xlim/ylim with care to avoid importing data that is too detailed, and
which is hard to use and visualise.
Roger
>> importGSHHS status:
>> --> Pass 1: complete: 0 bounding boxes within limits.
>> --> Pass 2:
>> Error in importGSHHS("C:/Users/Agus/Desktop/Distributional range
>> size/GSHHS_shp/gshhs_land.shp", :
>> call to gshhs failed.
>>
>> Could you please give me any hint?
>>
>
> John Ortiz
> Smithsonian Tropical Research Institute
> Panama
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
--
Roger Bivand
Department of Economics, NHH Norwegian School of Economics,
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
More information about the R-sig-Geo
mailing list