[R-sig-Geo] Drawing the maximum-area rectangle in a non-convex polygon

Tiernan Martin tiernanmartin at gmail.com
Tue Apr 12 23:48:30 CEST 2016


Hi Barry –

Are you referring to the javascript code detailed here:
http://d3plus.org/assets/posts/largestRect/src/largestRect.coffee ?

I don't know much about running javascript in R, but I would be willing to
give it a shot for this project. However, since this would be my first time
trying to run JS code in R (and given that the algorithm itself isn't
exactly a simple one) I thought I would start by querying the R user
community to see if there's already an R implementation of something
similar. It had also occurred to me that I could attempt to reimplement the
JS code using R functions, but that project quickly took me beyond my R
skill set.

It certainly seems to be the sort of spatial analysis problem that could be
applicable to lots of different projects, so I'm hoping to get some
feedback from folks with deeper understanding of programming and R – or
simply to have someone point out a nicely packaged set of functions that
could do this analysis.

Thanks for your advice, Barry!



On Tue, Apr 12, 2016 at 1:57 PM Barry Rowlingson <
b.rowlingson at lancaster.ac.uk> wrote:

> Could you simply use the Javascript code in that web page via one of
> the R-Javascript interface packages?
>
> On Tue, Apr 12, 2016 at 8:42 PM, Tiernan Martin <tiernanmartin at gmail.com>
> wrote:
> > Does anyone know if there is an R package out there with an algorithm
> which
> > finds the maximum-area rectangle that can fit within a non-convex
> polygon?
> > I have Googled, searched the R Sig Geo archives, and created a post on
> the
> > GIS Stackexchange to no avail.
> >
> > Here is an example of the type of output I am looking for:
> > http://d3plus.org/assets/posts/largestRect/img/solution.png
> >
> > As you can probably infer from the image, the algorithm searches for the
> > rectangle with the largest area that will fit within the boundary of the
> > non-convex polygon. My project will be applying this analysis to a set of
> > parcels (aka plots, plats, or cadastres) in order to estimate the
> footprint
> > of a largest rectangular building that could be built on each parcel. The
> > image linked above comes from the following post which showcases the type
> > of algorithm that would be useful for my project:
> > http://d3plus.org/blog/behind-the-scenes/2014/07/08/largest-rect/
> >
> > Is there an existing R package that I could use to conduct such an
> analysis
> > of several non-convex polygon? Or perhaps a set of functions from a
> > combination of packages?
> >
> > Thank you in advance,
> >
> > Tiernan
> >
> > PS – here's a link to my (very similarly worded) SO post:
> >
> http://gis.stackexchange.com/questions/186881/is-there-an-r-package-for-finding-the-largest-rectangle-in-a-non-convex-polygon
> >
> >         [[alternative HTML version deleted]]
> >
> > _______________________________________________
> > R-sig-Geo mailing list
> > R-sig-Geo at r-project.org
> > https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list