Re: [R-sig-Geo] Add +1 to current value of a cell in a raster in R

2016-07-10 Thread Vijay Lulla
OOPS!  I appear to have misunderstood the question then, Ben.  I'm unsure
how to increment a particular cell more than once.

Please pardon the noise.

On Sun, Jul 10, 2016 at 7:54 PM, Ben Tupper  wrote:

> Hi,
>
> Interesting.  How would you use the matrix approach to increment a
> particular cell more than once with a single subassignment?  If I repeat
> the upper left raster coord in the matrix 3 times it still yields a value
> of 1 up there.
>
> library(raster)
> r <- raster(nrows=5,ncols=5)
> r[] <- 0
> idx <- matrix(c(1,1,1,1,1,1,1,5,5,1,5,5),ncol=2,byrow=TRUE)
> r[idx] <- r[idx] + 1
> plot(r)
> range(getValues(r))
> #[1] 0 1
>
> I could be misreading the original posting, but I think the desire is that
> the result will be increment for each repeated index using just one
> subassignment.
>
> Cheers,
> Ben
>
>
> On Jul 10, 2016, at 6:45 PM, Vijay Lulla  wrote:
>
> Maybe something like this?
>
> R> r <- raster(nrows=5,ncols=5)
> R> r[] <- 0
> R> idx <- matrix(c(1,1,1,5,5,1,5,5),ncol=2,byrow=TRUE) # four corners of
> the raster!
> R> r[idx] <- r[idx] + 1
> R> image(r)
>
> From R's ?`[` : When indexing arrays by '[' a single argument 'i' can be a
> matrix with as many columns as there are dimensions of 'x'; the result is
> then a vector with elements corresponding to the sets of indices in each
> row of 'i'.
>
>
> On Sun, Jul 10, 2016 at 5:59 PM, Ben Tupper  wrote:
>
>> Hi,
>>
>> I stub my toe on this all the time (and wish I didn't).  The behavior
>> isn't limited to raster - the replacement operator `[` in general doesn't
>> update the left had side like my wild imagination might allow.  It's just a
>> function and so it must make a copy of the input.
>>
>> This note seen here ?`[` sort of points out the issue... "Subassignment
>> is done sequentially, so if an index is specified more than once the latest
>> assigned value for an index will result."  Between that, the phase of the
>> moon and the pass-by-value stuff my brain starts to jumble.
>>
>> On the other hand, if you have dependable indices and are simply
>> incrementing you can leverage table() for your purpose.
>>
>> x <- rep(0,5)
>> i <- c(1,1,1,4)
>> ti <- table(i)
>> tindex <- as.numeric(names(ti))
>> x[tindex] <- x[tindex] + ti
>>
>> Likewise for raster
>>
>> library(raster)
>> r <- raster(ncol=5,nrow=5)
>> r[] <- 0
>> vec <- c(1,1,1,3,4,5,6,7,8,8,8,9)
>> tvec <- table(vec)
>> tindex <- as.integer(names(tvec))
>> r[tindex] <- r[tindex] + tvec
>>
>> I hope there are smarter/faster ways, but in the meantime it might speed
>> things along for you.
>>
>>
>> Ben
>>
>>
>> > On Jul 10, 2016, at 3:34 PM, Giacomo May  wrote:
>> >
>> > Dear R-users,
>> > I am trying to add +1 to the cell value of certain cells in a raster. I
>> have the cell numbers of the cells on which I'd like to perform said
>> computation saved in a vector. I have a working code but with a large
>> vector and raster it takes ages:
>> >
>> > r <- raster(ncol=5,nrow=5)
>> > r[] <- 0
>> > vec <- c(1,1,1,3,4,5,6,7,8,8,8,9)
>> > for(i in 1:length(vec))
>> > {
>> > r[vec[i]] <- r[vec[i]] + 1
>> > }
>> >
>> > I have already tried to use r[vec] <- r[vec] + 1 but that doesn't work
>> properly, it just sets the values of the cells stored in the vector to 1.
>> Does anybody know a faster way to do this ? Thanks in advance!
>> >
>> > ___
>> > R-sig-Geo mailing list
>> > R-sig-Geo@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
>>
>> Report Gulf of Maine jellyfish sightings to jellyf...@bigelow.org or
>> tweet them to #MaineJellies -- include date, time, and location, as well as
>> any descriptive information such as size or type.  Learn more at
>> https://www.bigelow.org/research/srs/nick-record/nick-record-laboratory/mainejellies/
>>
>> ___
>> R-sig-Geo mailing list
>> R-sig-Geo@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
>
> Report Gulf of Maine jellyfish sightings to jellyf...@bigelow.org
> or tweet them to #MaineJellies -- include date, time, and location, as well
> as any descriptive information such as size or type.  Learn more at
> https://www.bigelow.org/research/srs/nick-record/nick-record-laboratory/mainejellies/
>
>

[[alternative HTML version deleted]]

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


Re: [R-sig-Geo] Add +1 to current value of a cell in a raster in R

2016-07-10 Thread Ben Tupper
Hi,

Interesting.  How would you use the matrix approach to increment a particular 
cell more than once with a single subassignment?  If I repeat the upper left 
raster coord in the matrix 3 times it still yields a value of 1 up there.

library(raster)
r <- raster(nrows=5,ncols=5)
r[] <- 0
idx <- matrix(c(1,1,1,1,1,1,1,5,5,1,5,5),ncol=2,byrow=TRUE) 
r[idx] <- r[idx] + 1
plot(r)
range(getValues(r))
#[1] 0 1

I could be misreading the original posting, but I think the desire is that the 
result will be increment for each repeated index using just one subassignment.  

Cheers,
Ben


> On Jul 10, 2016, at 6:45 PM, Vijay Lulla  wrote:
> 
> Maybe something like this?
> 
> R> r <- raster(nrows=5,ncols=5)
> R> r[] <- 0
> R> idx <- matrix(c(1,1,1,5,5,1,5,5),ncol=2,byrow=TRUE) # four corners of the 
> raster!
> R> r[idx] <- r[idx] + 1
> R> image(r)
> 
> From R's ?`[` : When indexing arrays by '[' a single argument 'i' can be a 
> matrix with as many columns as there are dimensions of 'x'; the result is 
> then a vector with elements corresponding to the sets of indices in each row 
> of 'i'.
> 
> 
> On Sun, Jul 10, 2016 at 5:59 PM, Ben Tupper  > wrote:
> Hi,
> 
> I stub my toe on this all the time (and wish I didn't).  The behavior isn't 
> limited to raster - the replacement operator `[` in general doesn't update 
> the left had side like my wild imagination might allow.  It's just a function 
> and so it must make a copy of the input.
> 
> This note seen here ?`[` sort of points out the issue... "Subassignment is 
> done sequentially, so if an index is specified more than once the latest 
> assigned value for an index will result."  Between that, the phase of the 
> moon and the pass-by-value stuff my brain starts to jumble.
> 
> On the other hand, if you have dependable indices and are simply incrementing 
> you can leverage table() for your purpose.
> 
> x <- rep(0,5)
> i <- c(1,1,1,4)
> ti <- table(i)
> tindex <- as.numeric(names(ti))
> x[tindex] <- x[tindex] + ti
> 
> Likewise for raster
> 
> library(raster)
> r <- raster(ncol=5,nrow=5)
> r[] <- 0
> vec <- c(1,1,1,3,4,5,6,7,8,8,8,9)
> tvec <- table(vec)
> tindex <- as.integer(names(tvec))
> r[tindex] <- r[tindex] + tvec
> 
> I hope there are smarter/faster ways, but in the meantime it might speed 
> things along for you.
> 
> 
> Ben
> 
> 
> > On Jul 10, 2016, at 3:34 PM, Giacomo May  > > wrote:
> >
> > Dear R-users,
> > I am trying to add +1 to the cell value of certain cells in a raster. I 
> > have the cell numbers of the cells on which I'd like to perform said 
> > computation saved in a vector. I have a working code but with a large 
> > vector and raster it takes ages:
> >
> > r <- raster(ncol=5,nrow=5)
> > r[] <- 0
> > vec <- c(1,1,1,3,4,5,6,7,8,8,8,9)
> > for(i in 1:length(vec))
> > {
> > r[vec[i]] <- r[vec[i]] + 1
> > }
> >
> > I have already tried to use r[vec] <- r[vec] + 1 but that doesn't work 
> > properly, it just sets the values of the cells stored in the vector to 1. 
> > Does anybody know a faster way to do this ? Thanks in advance!
> >
> > ___
> > R-sig-Geo mailing list
> > R-sig-Geo@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 
> 
> Report Gulf of Maine jellyfish sightings to jellyf...@bigelow.org 
>  or tweet them to #MaineJellies -- include 
> date, time, and location, as well as any descriptive information such as size 
> or type.  Learn more at 
> https://www.bigelow.org/research/srs/nick-record/nick-record-laboratory/mainejellies/
>  
> 
> 
> ___
> R-sig-Geo mailing list
> R-sig-Geo@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

Report Gulf of Maine jellyfish sightings to jellyf...@bigelow.org or tweet them 
to #MaineJellies -- include date, time, and location, as well as any 
descriptive information such as size or type.  Learn more at 
https://www.bigelow.org/research/srs/nick-record/nick-record-laboratory/mainejellies/


[[alternative HTML version deleted]]

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


Re: [R-sig-Geo] Add +1 to current value of a cell in a raster in R

2016-07-10 Thread Vijay Lulla
Maybe something like this?

R> r <- raster(nrows=5,ncols=5)
R> r[] <- 0
R> idx <- matrix(c(1,1,1,5,5,1,5,5),ncol=2,byrow=TRUE) # four corners of
the raster!
R> r[idx] <- r[idx] + 1
R> image(r)

>From R's ?`[` : When indexing arrays by '[' a single argument 'i' can be a
matrix with as many columns as there are dimensions of 'x'; the result is
then a vector with elements corresponding to the sets of indices in each
row of 'i'.


On Sun, Jul 10, 2016 at 5:59 PM, Ben Tupper  wrote:

> Hi,
>
> I stub my toe on this all the time (and wish I didn't).  The behavior
> isn't limited to raster - the replacement operator `[` in general doesn't
> update the left had side like my wild imagination might allow.  It's just a
> function and so it must make a copy of the input.
>
> This note seen here ?`[` sort of points out the issue... "Subassignment is
> done sequentially, so if an index is specified more than once the latest
> assigned value for an index will result."  Between that, the phase of the
> moon and the pass-by-value stuff my brain starts to jumble.
>
> On the other hand, if you have dependable indices and are simply
> incrementing you can leverage table() for your purpose.
>
> x <- rep(0,5)
> i <- c(1,1,1,4)
> ti <- table(i)
> tindex <- as.numeric(names(ti))
> x[tindex] <- x[tindex] + ti
>
> Likewise for raster
>
> library(raster)
> r <- raster(ncol=5,nrow=5)
> r[] <- 0
> vec <- c(1,1,1,3,4,5,6,7,8,8,8,9)
> tvec <- table(vec)
> tindex <- as.integer(names(tvec))
> r[tindex] <- r[tindex] + tvec
>
> I hope there are smarter/faster ways, but in the meantime it might speed
> things along for you.
>
>
> Ben
>
>
> > On Jul 10, 2016, at 3:34 PM, Giacomo May  wrote:
> >
> > Dear R-users,
> > I am trying to add +1 to the cell value of certain cells in a raster. I
> have the cell numbers of the cells on which I'd like to perform said
> computation saved in a vector. I have a working code but with a large
> vector and raster it takes ages:
> >
> > r <- raster(ncol=5,nrow=5)
> > r[] <- 0
> > vec <- c(1,1,1,3,4,5,6,7,8,8,8,9)
> > for(i in 1:length(vec))
> > {
> > r[vec[i]] <- r[vec[i]] + 1
> > }
> >
> > I have already tried to use r[vec] <- r[vec] + 1 but that doesn't work
> properly, it just sets the values of the cells stored in the vector to 1.
> Does anybody know a faster way to do this ? Thanks in advance!
> >
> > ___
> > R-sig-Geo mailing list
> > R-sig-Geo@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
>
> Report Gulf of Maine jellyfish sightings to jellyf...@bigelow.org or
> tweet them to #MaineJellies -- include date, time, and location, as well as
> any descriptive information such as size or type.  Learn more at
> https://www.bigelow.org/research/srs/nick-record/nick-record-laboratory/mainejellies/
>
> ___
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

[[alternative HTML version deleted]]

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


Re: [R-sig-Geo] Add +1 to current value of a cell in a raster in R

2016-07-10 Thread Ben Tupper
Hi,

I stub my toe on this all the time (and wish I didn't).  The behavior isn't 
limited to raster - the replacement operator `[` in general doesn't update the 
left had side like my wild imagination might allow.  It's just a function and 
so it must make a copy of the input.

This note seen here ?`[` sort of points out the issue... "Subassignment is done 
sequentially, so if an index is specified more than once the latest assigned 
value for an index will result."  Between that, the phase of the moon and the 
pass-by-value stuff my brain starts to jumble. 

On the other hand, if you have dependable indices and are simply incrementing 
you can leverage table() for your purpose.

x <- rep(0,5)
i <- c(1,1,1,4)
ti <- table(i)
tindex <- as.numeric(names(ti))
x[tindex] <- x[tindex] + ti

Likewise for raster

library(raster)
r <- raster(ncol=5,nrow=5)
r[] <- 0
vec <- c(1,1,1,3,4,5,6,7,8,8,8,9)
tvec <- table(vec)
tindex <- as.integer(names(tvec))
r[tindex] <- r[tindex] + tvec

I hope there are smarter/faster ways, but in the meantime it might speed things 
along for you.  


Ben


> On Jul 10, 2016, at 3:34 PM, Giacomo May  wrote:
> 
> Dear R-users,
> I am trying to add +1 to the cell value of certain cells in a raster. I have 
> the cell numbers of the cells on which I'd like to perform said computation 
> saved in a vector. I have a working code but with a large vector and raster 
> it takes ages:
> 
> r <- raster(ncol=5,nrow=5)
> r[] <- 0
> vec <- c(1,1,1,3,4,5,6,7,8,8,8,9)
> for(i in 1:length(vec))
> {
> r[vec[i]] <- r[vec[i]] + 1
> }
> 
> I have already tried to use r[vec] <- r[vec] + 1 but that doesn't work 
> properly, it just sets the values of the cells stored in the vector to 1. 
> Does anybody know a faster way to do this ? Thanks in advance!
> 
> ___
> R-sig-Geo mailing list
> R-sig-Geo@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

Report Gulf of Maine jellyfish sightings to jellyf...@bigelow.org or tweet them 
to #MaineJellies -- include date, time, and location, as well as any 
descriptive information such as size or type.  Learn more at 
https://www.bigelow.org/research/srs/nick-record/nick-record-laboratory/mainejellies/

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


Re: [R-sig-Geo] Minimum bounding circle from cluster of points (Tina Cormier)

2016-07-10 Thread Robert J. Hijmans
Here is a solution using optimization

library(raster)
library(rgeos)

set.seed(7)
n <- 4
xy <- cbind(runif(n), runif(n))

f <- function(p) { max(pointDistance(rbind(p), xy, lonlat=FALSE)) }
p <- optim(colMeans(xy), f)
cc <- buffer(SpatialPoints(rbind(p$par)), width=p$value, quadsegs=45)

plot(cc)
points(xy, pch=20, cex=1.5)
points(rbind(p$par), pch='*', col='red', cex=3)
lines(rbind(p$par, c(p$par[1]+p$value, p$par[2])), col='blue', lwd=2, lty=2)
text(p$par[1]+0.5*p$value, p$par[2], paste("radius =", round(p$value,
2)), pos=3, cex=.85)
text(p$par[1], p$par[2], labels=paste0("(",paste(round(p$par, 2),
collapse=", "), ")"), pos=1, cex=.75)

Best, Robert

On Sun, Jul 10, 2016 at 6:01 AM, Michael Sumner  wrote:
> I also have a (much more simplistic) use of CGAL here, for a different
> algorithm but may help for seeing how to leverage it:
>
> https://github.com/mdsumner/cgalgris
>
> I've abandoned that now in favour of RTriangle, but still very interested
> in uses of CGAL with R if anyone knows any more.
>
> Cheers, Mike
>
> On Sun, Jul 10, 2016, 22:44 chris english 
> wrote:
>
>> Mel,
>>
>> Not a full implementation, but indicator of how one might do,
>> https://rforge.net/rcgal/git.html, that Simon Urbanek styles : rcgal - R
>> interface to a (small) subset of CGAL,
>> and has inside (function) that takes arbitrary shape files and x/y to say
>> inside or not.
>>
>> CGAL is a darn fine library and I guess you'd pick and choose which parts
>> you'd wrap for your purposes.
>>
>> Chris
>>
>> On Sun, Jul 10, 2016 at 3:50 AM, Bacou, Melanie  wrote:
>>
>> > Interesting problem, it seems the exact approach is given by Fischer,
>> 2003
>> > and is implemented in a C++ CGAL package (see
>> >
>> http://stackoverflow.com/questions/9063453/how-to-compute-the-smallest-bounding-sphere-enclosing-other-bounding-spheres
>> > ).
>> >
>> > I haven't found any binding for R, but there's an implementation in
>> > PostGIS `ST_MinimumBoundingCircle()` (see
>> > http://postgis.net/docs/ST_MinimumBoundingCircle.html).
>> >
>> > Others might be more up to date.
>> > --Mel.
>> >
>> >
>> >
>> > On 7/9/2016 6:38 AM, Adrian Baddeley wrote:
>> >
>> >> Tina Cormier  wrote:
>> >>
>> >> I'd like to create a circle around each cluster that is
>> >>> the smallest circle that would encompass all 4 points.
>> >>>
>> >> The circumcircle.
>> >>
>> >> Try the following:
>> >>
>> >> > ><
>> >> https://stat.ethz.ch/mailman/listinfo/r-sig-geo>library(spatstat)
>> >>
>> >> circumcircle <- function(x, ...) {   UseMethod("circumcircle") }
>> >>
>> >> circumcircle.owin <- function(x, ...) {
>> >>d2 <- fardist(x, ..., squared=TRUE)
>> >>z <- where.min(d2)
>> >>r <- sqrt(min(d2))
>> >>w <- disc(centre=z, radius=r)
>> >>return(w)
>> >> }
>> >>
>> >> circumcircle.ppp <- function(x, ...) {
>> >>circumcircle(convexhull(x))
>> >> }
>> >>
>> >>
>> >> Adrian Baddeley
>> >>
>> >> [[alternative HTML version deleted]]
>> >>
>> >> ___
>> >> R-sig-Geo mailing list
>> >> R-sig-Geo@r-project.org
>> >> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>> >>
>> >
>> > ___
>> > R-sig-Geo mailing list
>> > R-sig-Geo@r-project.org
>> > https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>> >
>>
>> [[alternative HTML version deleted]]
>>
>> ___
>> R-sig-Geo mailing list
>> R-sig-Geo@r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
> --
> Dr. Michael Sumner
> Software and Database Engineer
> Australian Antarctic Division
> 203 Channel Highway
> Kingston Tasmania 7050 Australia
>
> [[alternative HTML version deleted]]
>
> ___
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

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


Re: [R-sig-Geo] Learning hydroGOF Package

2016-07-10 Thread Thomas Adams
Try Googling "hydroGOF"; you'll find:

https://cran.r-project.org/web/packages/hydroGOF/vignettes/hydroGOF_Vignette.pdf
http://www.slideshare.net/hzambran/egu2012-11549go-fsforextremeevents4web
http://www.slideshare.net/hzambran/egu2010-ra-statisticalenvironmentfordoinghydrologicalanalysis-9095709

http://scisoft-net-map.isri.cmu.edu/application/hydroGOF/used_with

https://gist.github.com/johnDorian/773aa58633d6c4261a24
https://www.mpimet.mpg.de/fileadmin/land/Interaction/Documentation.pdf




On Sun, Jul 10, 2016 at 3:45 AM, Iztirab Hussain via R-sig-Geo <
r-sig-geo@r-project.org> wrote:

> Hi, I am quite new here on this forum.
> Basically  i have to learn hydroGOF package of Rstudio so is there any
> video tutorial/ training/exercise/ workshop or lecture about hydroGOF
> package?I could not found more then txt tutorial of this package which is
> bit difficult to pick up for me.
>
> Regards
> HiztirabBeijing. ChinaChinese Academy of Sciences
> [[alternative HTML version deleted]]
>
> ___
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

[[alternative HTML version deleted]]

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


[R-sig-Geo] Add +1 to current value of a cell in a raster in R

2016-07-10 Thread Giacomo May
Dear R-users,
I am trying to add +1 to the cell value of certain cells in a raster. I have 
the cell numbers of the cells on which I'd like to perform said computation 
saved in a vector. I have a working code but with a large vector and raster it 
takes ages:

r <- raster(ncol=5,nrow=5)
r[] <- 0
vec <- c(1,1,1,3,4,5,6,7,8,8,8,9)
for(i in 1:length(vec))
{
r[vec[i]] <- r[vec[i]] + 1
}

I have already tried to use r[vec] <- r[vec] + 1 but that doesn't work 
properly, it just sets the values of the cells stored in the vector to 1. Does 
anybody know a faster way to do this ? Thanks in advance!

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


Re: [R-sig-Geo] Minimum bounding circle from cluster of points (Tina Cormier)

2016-07-10 Thread Michael Sumner
I also have a (much more simplistic) use of CGAL here, for a different
algorithm but may help for seeing how to leverage it:

https://github.com/mdsumner/cgalgris

I've abandoned that now in favour of RTriangle, but still very interested
in uses of CGAL with R if anyone knows any more.

Cheers, Mike

On Sun, Jul 10, 2016, 22:44 chris english 
wrote:

> Mel,
>
> Not a full implementation, but indicator of how one might do,
> https://rforge.net/rcgal/git.html, that Simon Urbanek styles : rcgal - R
> interface to a (small) subset of CGAL,
> and has inside (function) that takes arbitrary shape files and x/y to say
> inside or not.
>
> CGAL is a darn fine library and I guess you'd pick and choose which parts
> you'd wrap for your purposes.
>
> Chris
>
> On Sun, Jul 10, 2016 at 3:50 AM, Bacou, Melanie  wrote:
>
> > Interesting problem, it seems the exact approach is given by Fischer,
> 2003
> > and is implemented in a C++ CGAL package (see
> >
> http://stackoverflow.com/questions/9063453/how-to-compute-the-smallest-bounding-sphere-enclosing-other-bounding-spheres
> > ).
> >
> > I haven't found any binding for R, but there's an implementation in
> > PostGIS `ST_MinimumBoundingCircle()` (see
> > http://postgis.net/docs/ST_MinimumBoundingCircle.html).
> >
> > Others might be more up to date.
> > --Mel.
> >
> >
> >
> > On 7/9/2016 6:38 AM, Adrian Baddeley wrote:
> >
> >> Tina Cormier  wrote:
> >>
> >> I'd like to create a circle around each cluster that is
> >>> the smallest circle that would encompass all 4 points.
> >>>
> >> The circumcircle.
> >>
> >> Try the following:
> >>
> >>  ><
> >> https://stat.ethz.ch/mailman/listinfo/r-sig-geo>library(spatstat)
> >>
> >> circumcircle <- function(x, ...) {   UseMethod("circumcircle") }
> >>
> >> circumcircle.owin <- function(x, ...) {
> >>d2 <- fardist(x, ..., squared=TRUE)
> >>z <- where.min(d2)
> >>r <- sqrt(min(d2))
> >>w <- disc(centre=z, radius=r)
> >>return(w)
> >> }
> >>
> >> circumcircle.ppp <- function(x, ...) {
> >>circumcircle(convexhull(x))
> >> }
> >>
> >>
> >> Adrian Baddeley
> >>
> >> [[alternative HTML version deleted]]
> >>
> >> ___
> >> R-sig-Geo mailing list
> >> R-sig-Geo@r-project.org
> >> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> >>
> >
> > ___
> > R-sig-Geo mailing list
> > R-sig-Geo@r-project.org
> > https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> >
>
> [[alternative HTML version deleted]]
>
> ___
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
-- 
Dr. Michael Sumner
Software and Database Engineer
Australian Antarctic Division
203 Channel Highway
Kingston Tasmania 7050 Australia

[[alternative HTML version deleted]]

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


Re: [R-sig-Geo] Minimum bounding circle from cluster of points (Tina Cormier)

2016-07-10 Thread chris english
Mel,

Not a full implementation, but indicator of how one might do,
https://rforge.net/rcgal/git.html, that Simon Urbanek styles : rcgal - R
interface to a (small) subset of CGAL,
and has inside (function) that takes arbitrary shape files and x/y to say
inside or not.

CGAL is a darn fine library and I guess you'd pick and choose which parts
you'd wrap for your purposes.

Chris

On Sun, Jul 10, 2016 at 3:50 AM, Bacou, Melanie  wrote:

> Interesting problem, it seems the exact approach is given by Fischer, 2003
> and is implemented in a C++ CGAL package (see
> http://stackoverflow.com/questions/9063453/how-to-compute-the-smallest-bounding-sphere-enclosing-other-bounding-spheres
> ).
>
> I haven't found any binding for R, but there's an implementation in
> PostGIS `ST_MinimumBoundingCircle()` (see
> http://postgis.net/docs/ST_MinimumBoundingCircle.html).
>
> Others might be more up to date.
> --Mel.
>
>
>
> On 7/9/2016 6:38 AM, Adrian Baddeley wrote:
>
>> Tina Cormier  wrote:
>>
>> I'd like to create a circle around each cluster that is
>>> the smallest circle that would encompass all 4 points.
>>>
>> The circumcircle.
>>
>> Try the following:
>>
>> <
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo>library(spatstat)
>>
>> circumcircle <- function(x, ...) {   UseMethod("circumcircle") }
>>
>> circumcircle.owin <- function(x, ...) {
>>d2 <- fardist(x, ..., squared=TRUE)
>>z <- where.min(d2)
>>r <- sqrt(min(d2))
>>w <- disc(centre=z, radius=r)
>>return(w)
>> }
>>
>> circumcircle.ppp <- function(x, ...) {
>>circumcircle(convexhull(x))
>> }
>>
>>
>> Adrian Baddeley
>>
>> [[alternative HTML version deleted]]
>>
>> ___
>> R-sig-Geo mailing list
>> R-sig-Geo@r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>
> ___
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

[[alternative HTML version deleted]]

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


[R-sig-Geo] Learning hydroGOF Package

2016-07-10 Thread Iztirab Hussain via R-sig-Geo
Hi, I am quite new here on this forum.
Basically  i have to learn hydroGOF package of Rstudio so is there any video 
tutorial/ training/exercise/ workshop or lecture about hydroGOF package?I could 
not found more then txt tutorial of this package which is bit difficult to pick 
up for me.

Regards
HiztirabBeijing. ChinaChinese Academy of Sciences
[[alternative HTML version deleted]]

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