Hello, I have a distribution dataset for species consisting of xy coordinates at the 1km resolution, with only presence data. So a simplified example of a species distribution might be: y <- rbind(as.integer(rnorm(100,50,20)), as.integer(rnorm(200,100,30)), as.integer(rnorm(100,180,15))) x <- rbind(as.integer(rnorm(200,50,20)), as.integer(rnorm(200,100,20)), as.integer(rnorm(100,200,15))) plot(y~x) I would like to create polygons for each species distribution, where if an island is present (as I have tried to show in the example), it would be a seperate polygon, and the jagged edges of coastlines etc are maintained. I have spent ages trying to find a package that will allow me to convert scattered point distributions to polygons but haven't found anything that works, the functions I have found require the data already to be in the format where the only xy coordinates present are the outline of the polygon. Can anyone please recommend a function I can use here, or suggest a way of extracting the outline points? I have tried this manually but cannot seem to write a code that will effectively take account of jagged edges and islands. Thanks very much for your help, Louise. [[alternative HTML version deleted]]
This might be a question for the R-SIG-Geo or R-SIG-Ecology lists. Best, Michael On Wed, Mar 14, 2012 at 7:13 AM, Louise Mair <lm609 at york.ac.uk> wrote:> Hello, > > I have a distribution dataset for species consisting of xy coordinates at > the 1km resolution, with only presence data. So a simplified example of a > species distribution might be: > > y <- rbind(as.integer(rnorm(100,50,20)), as.integer(rnorm(200,100,30)), > as.integer(rnorm(100,180,15))) > x <- rbind(as.integer(rnorm(200,50,20)), as.integer(rnorm(200,100,20)), > as.integer(rnorm(100,200,15))) > plot(y~x) > > I would like to create polygons for each species distribution, where if an > island is present (as I have tried to show in the example), it would be a > seperate polygon, and the jagged edges of coastlines etc are maintained. I > have spent ages trying to find a package that will allow me to convert > scattered point distributions to polygons but haven't found anything that > works, the functions I have found require the data already to be in the > format where the only xy coordinates present are the outline of the > polygon. > > Can anyone please recommend a function I can use here, or suggest a way of > extracting the outline points? I have tried this manually but cannot seem > to write a code that will effectively take account of jagged edges and > islands. > > Thanks very much for your help, > > Louise. > > ? ? ? ?[[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > 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.
No time to really think about this, but: a) to "convert scattered point distributions to polygons" you might look at convex hulls; e.g. convhulln {geometry} b) to identify islands some kind of cluster analysis Hope that helps a little. KJ "Louise Mair" <lm609 at york.ac.uk> wrote in message news:CAMkzT57pep1zKPgm2DG5TN6r0P-_O5Tf+wSnURXdOHF8zVMnpw at mail.gmail.com...> Hello, > > I have a distribution dataset for species consisting of xy coordinates at > the 1km resolution, with only presence data. So a simplified example of a > species distribution might be: > > y <- rbind(as.integer(rnorm(100,50,20)), as.integer(rnorm(200,100,30)), > as.integer(rnorm(100,180,15))) > x <- rbind(as.integer(rnorm(200,50,20)), as.integer(rnorm(200,100,20)), > as.integer(rnorm(100,200,15))) > plot(y~x) > > I would like to create polygons for each species distribution, where if an > island is present (as I have tried to show in the example), it would be a > seperate polygon, and the jagged edges of coastlines etc are maintained. I > have spent ages trying to find a package that will allow me to convert > scattered point distributions to polygons but haven't found anything that > works, the functions I have found require the data already to be in the > format where the only xy coordinates present are the outline of the > polygon. > > Can anyone please recommend a function I can use here, or suggest a way of > extracting the outline points? I have tried this manually but cannot seem > to write a code that will effectively take account of jagged edges and > islands. > > Thanks very much for your help, > > Louise. > > [[alternative HTML version deleted]] >
Reasonably Related Threads
- creating categorical frequency tables from continuous data
- chisq.test vs manual calculation - why are different results produced?
- indeterminate for loop
- Unexpected values obtained when reading in data using ncdf and ncdf4
- Unexpected values obtained when reading in data using ncdf and ncdf4