[R-sig-Geo] Wrap around distribution

Chris Clements chrisclementsresearch at gmail.com
Tue Sep 16 10:32:08 CEST 2014


Dear all,

I am currently plotting very simple marine species distributions based on presence data using gConvexhull. The species I am working on is large and cosmopolitan, so I would like to be able to plot a distribution that “wraps” around the world, but in a 2d. So it the below example, the polygon would extend east and west to the edge of the world map:

rm(list=ls())
library(maptools)
library(rgeos)
data(wrld_simpl)

sightings <- gConvexHull(readWKT("GEOMETRYCOLLECTION(POINT(-120  -45), POINT(20  0), POINT(0  30), POINT(150 -50), POINT(-160  20), POINT(60 -10), POINT(145  -5))"))

plot(sightings, col="lightblue", lty=0, xlim=c(-180, 180))

plot(wrld_simpl, add=T, col="black")


Any help much appreciated.
Chris


_______________________________________________

Dr Christopher Clements

The University of Zürich,
Switzerland

Research: www.chrisclementsresearch.co.uk
Email: chrisclementsresearch at gmail.com
Mobile: (+44)7708945975
Twitter: CClements88
Skype: chris.clements88





	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list