Concatening two maps/shapefiles...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Concatening two maps/shapefiles...

Nicolas Degallier-2
Dear All,
I'm new with mapping and using shapefiles in R.

I use the version: R 3.2.1 GUI 1.66 with Snow Leopard Mac OS (6956)

I want to build a map of the countries of Africa, in order to add points of collecting species of beetles, for later publishing.

library(maptools)
library(mapdata)

When I put the extreme coordinates of Africa, the map began only at longitude 0° and thus lacks the west africa part:

x<-map('world2Hires', xlim=c(-18,52), ylim=c(-35,38))

I attempted with the following script:


E<-map('world2Hires', xlim=c(0,52), ylim=c(-35,38))
W<-map('world2Hires', xlim=c(342,360), ylim=c(-35,38))

It ran fine but now I don't know how to get these two maps jointed.
I guess it may be trivial but I didn't found nothing about this in the available tutorials.
Cheers,
Nicolas Degallier



Nicolas Degallier
120 rue de Charonne
F-75011 Paris

[hidden email]
Publications :
http://www.documentation.ird.fr/hor/DEGALLIER,NICOLAS/tout

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: Concatening two maps/shapefiles...

MacQueen, Don
I would try using the xlim, ylim arguments in your first map() command, and then using the add argument in the second one. See the help page for the map function.

This assumes that the map() function you are using comes from the maps package.

Otherwise, perhaps you should be using the rgdal package to load your shapefiles into R (you did mention shapefiles), and the basic plot() command to plot them. Depending on whether you choose to use the 'sp' package or the 'sf' package.

See also the R-sig-geo mailing list.

-Don

--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
Lab cell 925-724-7509
 
 
On 2/5/18, 10:40 AM, "R-help on behalf of Nicolas Degallier" <[hidden email] on behalf of [hidden email]> wrote:

    Dear All,
    I'm new with mapping and using shapefiles in R.
   
    I use the version: R 3.2.1 GUI 1.66 with Snow Leopard Mac OS (6956)
   
    I want to build a map of the countries of Africa, in order to add points of collecting species of beetles, for later publishing.
   
    library(maptools)
    library(mapdata)
   
    When I put the extreme coordinates of Africa, the map began only at longitude 0° and thus lacks the west africa part:
   
    x<-map('world2Hires', xlim=c(-18,52), ylim=c(-35,38))
   
    I attempted with the following script:
   
   
    E<-map('world2Hires', xlim=c(0,52), ylim=c(-35,38))
    W<-map('world2Hires', xlim=c(342,360), ylim=c(-35,38))
   
    It ran fine but now I don't know how to get these two maps jointed.
    I guess it may be trivial but I didn't found nothing about this in the available tutorials.
    Cheers,
    Nicolas Degallier
   
   
   
    Nicolas Degallier
    120 rue de Charonne
    F-75011 Paris
   
    [hidden email]
    Publications :
    http://www.documentation.ird.fr/hor/DEGALLIER,NICOLAS/tout
   
    ______________________________________________
    [hidden email] mailing list -- To UNSUBSCRIBE and more, see
    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.
   

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.