2

I am trying to get the centroid of a several areas in a large raster data set.

The output needs to be raster format, with one pixel representing the center of each patch, in the same resolution as the input raster. I tried using the feature to point tool and then converting the point output to raster, but this takes an incredibly long time to process, meaning this task may take me several days as I have several rasters I need to do this for.

I was hoping to find a quicker way that doesn't involve switching between rasters and features. Essentially, I'd like to do the equivalent of 'feature to point' but with a raster.

Does anybody know a way to do this? I am relatively new to ArcGIS so don't know how to use Python unfortunately!

I'm using ArcGIS 10.2 Advanced license

1
  • we need to know the version and license level of ArcGIS. please edit the original question with more information.
    – Brad Nesom
    Jul 13, 2015 at 15:52

1 Answer 1

2

You can't create centroids directly from rasters, you must first convert them into vector (polygons) and then gain the centroid from the polygons.

You should only convert classified raster to polygon as continuous datasets aren't allowed by the tool; rasters comprising of many rapidly changing values may not be converted due to shapefile size restrictions or take a very long time. From the sounds of it you have classified your raster so it should be suitable.

To convert the raster to a polygon feature class use Raster to Polygon, at your discretion simplify or not, it would be quicker not to simplify but wouldn't change the output too much.

Now, extract the centroids from the polygons using Feature to Point with the CENTROID option (there should be no multipart polygons to confuse the issue).

To further refine the points into rounded (cell) coordinates you can convert point to raster using a snap raster and cell size of the original raster then convert that raster into points. You will possibly loose whatever attribution was present in the original polygons but a simple Spatial Join will get that information back for you.

4
  • Thanks Michael. What you describe is what I had been trying to do, but unfortunately the 'point to raster' tool is taking such a long time, I haven't managed to get any outputs yet. I left it running for about 18 hours and it still hadn't completed. Is this normal or could it be something about the way I am doing the task?
    – K.Bumble
    Jul 14, 2015 at 9:06
  • I think the problem I have is that the cell size unit on the point to raster tool appears to be different from every other tool. When I specify that I would like the output pixels to be 90m, it interprets it as 90km- even though on the properties of the resultant layer it will say it is 90m. When I account for this and ask it to make a cell size of 0.9, it takes hours and I don't think it can cope with it. I can't find how to check why this is happening or to change the assumed units of the point to raster tool.
    – K.Bumble
    Jul 14, 2015 at 12:22
  • It shouldn't take very long at all to run point to raster. Would you consider GDAL_Rasterize instead gdal.org/gdal_rasterize.html, first create your empty raster resources.esri.com/help/9.3/arcgisengine/java/gp_toolref/… - use an uncompressed format (Tiff, Img, GRID - prefer Tiff or Img) then run the tool to 'burn in' the points - it should take only a few minutes. Jul 14, 2015 at 21:34
  • I got around it in the end by using an older version of ArcGIS. It seems that in 10.2, the points to raster tool has a few glitches- it interpretted the cellsize in the wrong units but couldn't compensate for it if you put in decimals, and also seemed to cope better with a UTM geographic coordinate system than the projection I was using (Albers South America). Thanks for your help.
    – K.Bumble
    Jul 15, 2015 at 20:54

Your Answer

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

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