Skip to content

How to get the coordinates (latitude/longitude) of a continent outline?

6 messages · Zivan Karaman, Sohrab Abbasnejad, Ben Tupper

#
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
#
Hi,

There is a whole world of options (sorry for the lame pun!), but I would recommend checking out ROpenSci's rnaturalearth package

https://ropensci.org/tutorials/rnaturalearth_tutorial/ <https://ropensci.org/tutorials/rnaturalearth_tutorial/>

https://CRAN.R-project.org/package=rnaturalearth <https://cran.r-project.org/package=rnaturalearth>

Ben
Ben Tupper
Bigelow Laboratory for Ocean Sciences
60 Bigelow Drive, P.O. Box 380
East Boothbay, Maine 04544
http://www.bigelow.org

Ecological Forecasting: https://eco.bigelow.org/
#
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 at r-project.org> a ?crit :

  
  
#
Dear Ben,

Thank you for your reply.

So far as I am aware, the rnaturalearth package provides information about countries within a continent, states within countries and "world" coastline (subsetting the coastline is not possible). Nevertheless, the package does not include maps/data of "continents". What I need is the coordinates of Africa's outline (as a single entity), not the coordinates of countries' outlines within Africa.

Best,
Sohrab
On ?Saturday?, ?February? ?2?, ?2019? ?03?:?38?:?25? ?PM? ?CET, Ben Tupper wrote:
Hi,
There is a whole world of options (sorry for the lame pun!), but I would recommend checking out ROpenSci's rnaturalearth package
https://ropensci.org/tutorials/rnaturalearth_tutorial/
https://CRAN.R-project.org/package=rnaturalearth
Ben
On Feb 2, 2019, at 8:36 AM, Sohrab Abbasnejad via R-sig-Geo <r-sig-geo at r-project.org> wrote:
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





_______________________________________________
R-sig-Geo mailing list
R-sig-Geo at r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


Ben Tupper
Bigelow Laboratory for Ocean?Sciences
60 Bigelow Drive, P.O. Box 380
East Boothbay, Maine 04544
http://www.bigelow.org
Ecological Forecasting: https://eco.bigelow.org/
#
Dear Zivan,

Your solution did the job! Thank you very much!

Best,
Sohrab
On ?Saturday?, ?February? ?2?, ?2019? ?04?:?07?:?27? ?PM? ?CET, Zivan Karaman <zivan.karaman at gmail.com> wrote:
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 warningssp::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 argumentb <- 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 at 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 at r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
#
Hi,

Yes, I flubbed that.  I had it in my head that this...

https://www.naturalearthdata.com/downloads/110m-physical-vectors/110m-land/ <https://www.naturalearthdata.com/downloads/110m-physical-vectors/110m-land/>

... had Africa as a stand alone polygon, but that is not so.  Sorry for the noise.

Ben
Ben Tupper
Bigelow Laboratory for Ocean Sciences
60 Bigelow Drive, P.O. Box 380
East Boothbay, Maine 04544
http://www.bigelow.org

Ecological Forecasting: https://eco.bigelow.org/