[R-sig-Geo] RE : determining suitable lakes for landing

Bastien.Ferland-Raymond at mrnf.gouv.qc.ca Bastien.Ferland-Raymond at mrnf.gouv.qc.ca
Mon Jul 30 18:16:33 CEST 2012


Thanks Barry for your interest in my problem.  It is indeed an interesting problem at the same time as a complex one.

I've tried your code and it works for two lakes so far.  It's seems like a very good base for what I want to do.  I'll modify it a little to speed it up.  First by removing the very small lakes, than by changing the loop "for" by a "while" as I just need to find if I can fit or not a rectangle, I don't need the rectangle(s).

Here is a example of shape I'm going to apply it to:

https://www.dropbox.com/s/24eg0eetm0o6dth/lacs_amerrissables.zip

There is already a field telling if you could land of not ("AMERISS") that was found by some old ARCgis coding (ARCinfo and aml, not sure exactly how).  It was a consultant that did this code for us a couple of years ago, now we want to transfer to R, explaining why I have this problem now.  The code was also using iteration, however not random, on rasterized lakes.  I think it would be interesting to compare the result from the 2 techniques.

I'm going to try that this afternoon, and let you know the result.

Thanks again!

Bastien

-----Message d'origine-----
De : b.rowlingson at googlemail.com [mailto:b.rowlingson at googlemail.com] De la part de Barry Rowlingson
Envoyé : 30 juillet 2012 11:41
À : Ferland-Raymond, Bastien (DIF)
Cc : r-sig-geo at r-project.org
Objet : Re: [R-sig-Geo] determining suitable lakes for landing

On Mon, Jul 30, 2012 at 1:52 PM, Rowlingson, Barry
<b.rowlingson at lancaster.ac.uk> wrote:

>> Anybody have an idea how to place the rectangle and discriminate those lakes?

To save pasting masses of code in here, I've put a random rectangle
tester in a gist:

https://gist.github.com/3207893

 that does a stupid brute-force approach of trying random NxM
rectangles at random angles all over the polygon until it finds one or
gives up. I reckon any polygon that doesn't get a solution after 5000
trials is probably so horrendous that no pilot would want to land
there anyway...

Barry



More information about the R-sig-Geo mailing list