2

Please refer to the attached image. The overlay on the map shows a raster file with disconnected circles. I want to split each of those circles into independent rasters in one shot.

Is that even possible? If yes how? If not whats the fastest way to do it?

enter image description here

2
  • The circles don't look disconnected to me, especially near downtown. Is a web service generating the image that has the circles? If so, what sort of web service? Commented Aug 30, 2011 at 16:09
  • @Krik, The circles which are connected are one entity and need to go into one file. Is being rendered by WMS hosted on Geoserver. The Raster is Lidar Data.
    – Shaunak
    Commented Aug 30, 2011 at 16:55

1 Answer 1

4

At a minimum you will need to identify each connected component, find its extent, clip to that extent and export it. The clip/export process has to be in a loop: it won't happen as a single operation. But that's straightforward to script. Let's therefore focus on getting to that point where you have a list of extents to clip and export.

Identify the connected components with a RegionGroup operation on an indicator grid. (A quick way to obtain an indicator grid is to equate the raster with itself: it will have just 1's and NoData values.) Using the regiongroup output grid as zones, compute zonal maxima and minima of the two coordinate grids (one for X and the other for Y). (How you obtain the coordinate grid depends on which version of ArcGIS you are using. Pre-10.0, $$XMap and $$YMap did the trick.) This produces a rectangular extent ((xmin, ymin), (xmax, ymax)) for each of the regions, but the extent only goes as far as the most extreme cell centers. Expand these extents symmetrically by one-half the cellsize to enclose all the cells, becoming ((xmin-cellsize/2, ymin-cellsize/2), (xmax+cellsize/2, ymax+cellsize/2)). Now you're ready for the clip/export loop.

Regardless of how many connected components the raster has, this workflow obtains the list of their extents in just six grid operations (a comparison to create the indicator, a regiongroup, two zonal mins, and two zonal maxes).

For a really clean job, at each step in the clip/export loop you can use the current region to mask the clip output to the region itself. This will avoid having bits and pieces of other regions appearing wherever they intrude into the current extent.

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.