Skip to main content
Solved

How to see if a template polygon with dimensions will fit inside of a parcel polygon?

  • June 20, 2023
  • 5 replies
  • 96 views

warrendev
Enthusiast
Forum|alt.badge.img+26

I have multiple site template polygons, with various dimensions. Let's say I have 2 polygons that are 100' x 100' and 200' x 200'. I then have multiple parcels that I need to see if any of the site templates fit inside the parcel polygons, no matter the orientation of the site.

 

What would be the best method to determine this? The outcome would be finding which site template, if any, would fit and the orientation within the parcel polygon.

Best answer by geomancer

This may be possible in FME, following an algorithm like this:

  1. Create a point grid inside the parcels
  2. Move a copy of each site template to every grid point (put the center of the site template on the grid point)
  3. Create copies of these copies, and rotate each copy with a different rotation angle around its center point
  4. Determine the site templates from step 3 that are completely within the parcels

Note that this algorithm creates many many temporary objects in step 3.

Some thoughts on optimalization:

  • You probably can reduce the number of grid points, as some grid points are too close to the edge of the parcels for a possible fit of the site templates. So it may be possible to inwardly buffer the parcels before creating the point grid. This is certainly the case with your site templates, as they are squares.
  • The accuracy of this algorithm depends on the distance between the points in the point grid and the step size of rotating the site templates. Smaller values increase the possibility of finding fits, but also create many more temporary objects.
  • Your example site templates are squares, so you can suffice with fewer copies in step 3 (after applying a rotation of 90 degrees around the center point you get the original site template).

 

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

5 replies

geomancer
Evangelist
Forum|alt.badge.img+58
  • Evangelist
  • 932 replies
  • Best Answer
  • June 27, 2023

This may be possible in FME, following an algorithm like this:

  1. Create a point grid inside the parcels
  2. Move a copy of each site template to every grid point (put the center of the site template on the grid point)
  3. Create copies of these copies, and rotate each copy with a different rotation angle around its center point
  4. Determine the site templates from step 3 that are completely within the parcels

Note that this algorithm creates many many temporary objects in step 3.

Some thoughts on optimalization:

  • You probably can reduce the number of grid points, as some grid points are too close to the edge of the parcels for a possible fit of the site templates. So it may be possible to inwardly buffer the parcels before creating the point grid. This is certainly the case with your site templates, as they are squares.
  • The accuracy of this algorithm depends on the distance between the points in the point grid and the step size of rotating the site templates. Smaller values increase the possibility of finding fits, but also create many more temporary objects.
  • Your example site templates are squares, so you can suffice with fewer copies in step 3 (after applying a rotation of 90 degrees around the center point you get the original site template).

 


nielsgerrits
VIP
Forum|alt.badge.img+60
  • 2938 replies
  • June 27, 2023

This may be possible in FME, following an algorithm like this:

  1. Create a point grid inside the parcels
  2. Move a copy of each site template to every grid point (put the center of the site template on the grid point)
  3. Create copies of these copies, and rotate each copy with a different rotation angle around its center point
  4. Determine the site templates from step 3 that are completely within the parcels

Note that this algorithm creates many many temporary objects in step 3.

Some thoughts on optimalization:

  • You probably can reduce the number of grid points, as some grid points are too close to the edge of the parcels for a possible fit of the site templates. So it may be possible to inwardly buffer the parcels before creating the point grid. This is certainly the case with your site templates, as they are squares.
  • The accuracy of this algorithm depends on the distance between the points in the point grid and the step size of rotating the site templates. Smaller values increase the possibility of finding fits, but also create many more temporary objects.
  • Your example site templates are squares, so you can suffice with fewer copies in step 3 (after applying a rotation of 90 degrees around the center point you get the original site template).

 

Why the gridpoints instead of the vectordata? You also could move and rotate an area in a area, clip it, check if clipped.


geomancer
Evangelist
Forum|alt.badge.img+58
  • Evangelist
  • 932 replies
  • June 27, 2023

This may be possible in FME, following an algorithm like this:

  1. Create a point grid inside the parcels
  2. Move a copy of each site template to every grid point (put the center of the site template on the grid point)
  3. Create copies of these copies, and rotate each copy with a different rotation angle around its center point
  4. Determine the site templates from step 3 that are completely within the parcels

Note that this algorithm creates many many temporary objects in step 3.

Some thoughts on optimalization:

  • You probably can reduce the number of grid points, as some grid points are too close to the edge of the parcels for a possible fit of the site templates. So it may be possible to inwardly buffer the parcels before creating the point grid. This is certainly the case with your site templates, as they are squares.
  • The accuracy of this algorithm depends on the distance between the points in the point grid and the step size of rotating the site templates. Smaller values increase the possibility of finding fits, but also create many more temporary objects.
  • Your example site templates are squares, so you can suffice with fewer copies in step 3 (after applying a rotation of 90 degrees around the center point you get the original site template).

 

The points of the grid serve as destinations for moving (copies of) the site templates.

I thought I would give it a try, as there were no reactions to this question after almost a week.

I am certain there are other, better solutions.


warrendev
Enthusiast
Forum|alt.badge.img+26
  • Author
  • Enthusiast
  • 121 replies
  • June 27, 2023

Thanks @nielsgerrits​ and @geomancer​ ! What I ended up doing first was by creating a point grid and then rotating it 360 with different angle increments, etc. I will try the other solution as well. There are so many ways to accomplish this, so it will just take some trial and error to optimize it as much as possible. I appreciate the help.


geomancer
Evangelist
Forum|alt.badge.img+58
  • Evangelist
  • 932 replies
  • June 27, 2023

Thanks for the feedback.

When I tried to implement the ideas I mentioned above, I was surprised at the enormous amount of candidate boxes (which is how I called the site template polygons).

Fit_to_ParcelsThis workspace can certainly be improved. Good luck!