[R-sig-Geo] Maps of continents

Jari Oksanen jari.oksanen at oulu.fi
Wed Apr 29 17:33:22 CEST 2015


Dear Rui Barradas,

I'm sure you can get this work and get excellent results. However, I think the *easiest* solution is to get rworldmap package (like suggested earlier in this thread), where you do not need to do so many tricks to do what you try to do. For instance, plotting continents is much easier with rworldmap if you want to define the continent by geographical areas instead of a longitude/latitude ranges containing the continent plus other areas in that range.

Cheers, Jari Oksanen
On 29/04/2015, at 17:34 PM, Rui Barradas wrote:

> Hello,
> 
> Thank you. Now I have another problem, when I run the code you've provided error messages occur.
> 
> > library(maptools)
> > bordures<-readShapeSpatial("10m_cultural/ne_10m_admin_0_countries.shp")
> Error in getinfo.shape(fn) : Error opening SHP file
> >
> > library(rgdal)
> > readOGR(dsn="10m_cultural", layer="ne_10m_admin_0_countries")->bordures
> Error in ogrInfo(dsn = dsn, layer = layer, encoding = encoding, use_iconv = use_iconv,  :
>  Cannot open file
> 
> 
> How can I solve this?
> 
> Rui Barradas
> 
> 
> > sessionInfo()
> R version 3.2.0 (2015-04-16)
> Platform: x86_64-w64-mingw32/x64 (64-bit)
> Running under: Windows 7 x64 (build 7601) Service Pack 1
> 
> locale:
> [1] LC_COLLATE=Portuguese_Portugal.1252 LC_CTYPE=Portuguese_Portugal.1252
> [3] LC_MONETARY=Portuguese_Portugal.1252 LC_NUMERIC=C 
> [5] LC_TIME=Portuguese_Portugal.1252
> 
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
> 
> other attached packages:
> [1] maps_2.3-9      rworldmap_1.3-1 rgdal_0.9-2     maptools_0.8-36
> [5] sp_1.1-0
> 
> loaded via a namespace (and not attached):
> [1] tools_3.2.0     foreign_0.8-63  fields_8.2-1    grid_3.2.0
> [5] spam_1.0-1      lattice_0.20-31
> 
> 
> 
> Em 29-04-2015 12:23, Gilles Benjamin Leduc escreveu:
>> Hi
>> 
>> So, I would advise you: Find nice shapefiles of the world:
>> http://www.diva-gis.org/datadown
>> http://spatialanalysis.co.uk/
>> 
>> Then you load it, either :
>>  library(maptools)
>> bordures<-readShapeSpatial("10m_cultural/ne_10m_admin_0_countries.shp")
>> 
>> Or better:
>> library(rgdal)
>> readOGR(dsn="10m_cultural", layer="ne_10m_admin_0_countries")->bordures
>> 
>> then plot with good limits (here France)
>> plot(bordures,xlim=c( -4.3,9.1),ylim=c(41,51),axes = TRUE, col="grey")
>> 
>> I hope it helps
>> 
>> Benjamin
>> 
>> 
>> On Wednesday, April 29, 2015 09:18 GMT, Rui Barradas <ruipbarradas at sapo.pt> wrote:
>> 
>>> Hello,
>>> 
>>> This is a really basic question. I'm an R user but completely ignorant
>>> on geographical applications.
>>> I need to graph the 5 Continents, one on each graph. How can I do it?
>>> Which packages do I need to have installed and use?.
>>> 
>>> Thank you,
>>> 
>>> Rui Barradas
>>> 
>>> _______________________________________________
>>> R-sig-Geo mailing list
>>> R-sig-Geo at r-project.org
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>> 
>> 
>> 
>> 
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo



More information about the R-sig-Geo mailing list