# Calculate position to put box into another container? there has a big box, and the big box already contains many small box, then should place a new small box into the container.

How do I calculate a big enough space to place the small box?

There should be many place to hold the box.

How do I calculate at least one place?

Could not be rorate the small box.

Raster solution below is approximate but fast. Erase old small boxes from big box and convert what remains into integer raster with value of 1. Compute focal statistics SUM using rectangle shape corresponding to dimensions of a new small box. It is 30 m high and 50m wide in example below: Find cells where focal statistics == height*width. All matching cells (161 in this case) are potential centres for new box: As I mentione this is approximate solution, this is why new box has a bit of intersection with old one. This is because I placed its' centre in a lower left point. There are plenty more points to choose from.

• i'm a giser, but i don't use arcgis, is any paper/article explain focal statistics algorithm? or please show detailed steps.. – sendreams Sep 1 at 2:51
• desktop.arcgis.com/en/arcmap/10.4/tools/spatial-analyst-toolbox/…, the focal statistics calculate 3 by 3 cell neighborhood, if use 3 by 3, and the cell value is 1, the max value will be 9, how to up to 1500? – sendreams Sep 1 at 2:56
• i know, use 30 by 50 cell neighborhood instead of 3 by 3. – sendreams Sep 1 at 3:00