I have a raster image (green colour in image). I would like to find the point in this raster that is the farthest from the edge i.e. that point from which the largest number of uninterrupted cells in a given direction to the edge? sample of raster in question

  • Do you want to find the green pixel that has the longest minimal path that is only on green pixels? Or on any coloured pixels? That might be the green pixel nearest the centre. What about that green island in the middle? The distance on only-green cells from there is infinite if you can't go on the black pixels...
    – Spacedman
    Apr 30, 2019 at 14:14
  • I don't want to include the island as the black surrounding it are road/rivers. I want to find the green pixel that has the longest minimal path that is only on green pixels.
    – Dunuts
    Apr 30, 2019 at 23:28

1 Answer 1


QGIS has a tool for called "pole of inaccessibility" which does exactly what you ask for, with one caveat: it works on polygons, not rasters. Fortunately, it should be fairly simple to polygonize this raster.

enter image description here

Instructions to find the "pole of inaccessibility" for the green areas on your raster:

  1. Polygonize your raster. Quality control the new polygonized layer as follows:
    • Make sure the output is separate single polygon features, not multipolygon features. Run multipart to single part if necessary.
    • Make sure the output only contains the parts of the raster you want to analyze. If the black parts of the raster are not defined as "no data" areas, your polygonized layer will have polygons covering these areas as well. Select and delete any polygons that you don't want included in this analysis (the "select by value" tool might be helpful for this step).
  2. Calculate Pole of inaccessibility of the polygonized layer. This will create a new point layer, with a point in the most inaccessible spot inside each polygon.
  3. The new layer of inaccessible points has a field called "dist_pole" with the distance from the point to the boundary of the polygon. Select the point with the highest "dist_pole" value. This is the most inaccessible point on your raster.

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.