[R-sig-Geo] How to get the coordinates (latitude/longitude) of a continent outline?
Zivan Karaman
z|v@n@k@r@m@n @end|ng |rom gm@||@com
Sat Feb 2 16:07:16 CET 2019
Hello Sohrab,
You can start with country maps, and then merge them in a single polygon.
For example, get the maps as a shape file from here
http://www.maplibrary.org/library/stacks/Africa/Africa_SHP.zip, unzip this
file and run the following R code
library(sp)
library(rgdal)
library(rgeos)
countries <- rgdal::readOGR(dsn = ".", layer = "Africa")
sp::proj4string(countries) <- sp::CRS("+init=epsg:4326")
a <- rgeos::gBuffer(countries, width = 0)
# ignore the warnings
sp::proj4string(a) <- sp::CRS("+init=epsg:4326")
plot(a)
# this produces quite a detailed map with islands, lakes, etc.
# you can simplify it to suit your needs by tuning the tol argument
b <- rgeos::gSimplify(a, tol = 0.1)
plot(b)
Cheers,
Zivan
Le sam. 2 févr. 2019 à 14:36, Sohrab Abbasnejad via R-sig-Geo <
r-sig-geo using r-project.org> a écrit :
> Hello,
> I would like to have the list of coordinates of the boundary (outline) of
> a continent (Africa). The "map" function from the "maps" package gives the
> coordinates for country outlines, but not the for the continents.
>
> Does anybody have an idea where I can find the data?
>
> Thank you!
>
> Cheers,
> Sohrab
>
>
>
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
[[alternative HTML version deleted]]
More information about the R-sig-Geo
mailing list