[R] Creating polygons from scattered points

2012-03-14 Thread Louise Mair
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@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.


Re: [R] Creating polygons from scattered points

2012-03-14 Thread R. Michael Weylandt
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 lm...@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@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.

__
R-help@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.


Re: [R] Creating polygons from scattered points

2012-03-14 Thread Keith Jewell
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 lm...@york.ac.uk wrote in message 
news:camkzt57pep1zkpgm2dg5tn6r0p-_o5tf+wsnurxdohf8zvm...@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]]


__
R-help@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.