I have a shp file with hundreds of features that represent clipped segments of coastline. Each segment is made up of many vertices (dozens, perhaps even hundreds). (FYI, the segments were created by using circles 1km in diameter to clip the coastline at random locations. The clipped segments of coastline are quite convoluted, I am looking to evaluate just how convoluted each polyline is.)

I need to calculate the fractal dimension of each individual segment (polyline). In order to be able to compare them.

I am working with ArcMap 10.1, I also just got QGIS but am not proficient with this program.

I know what the mathematical formula is to calculate fractal dimension for a single line segment, but I have far too many to calculate them individually, and I do not know how to write a script that could do it for me.

Using the box counting method: Each line segment (or segment of coastline) is covered by a sequence of grids of descending sizes and then two values are recorded for each of the grids: the number of boxes that intersect with the line, N(L), and the side length of the box, L.

Note that N(L) ∝ L^(-D)

The fractal dimension is calculated as the slope of the linear regression best-fit line of log–log data.

Therefore: D = (logN)/[log(1/L)]

  • 2
    I'm not familiar with the calculation, but if it can be performed using attributes from a single record you could open the attribute table, create a new field to hold the value, then right-click on the field name and choose Field Calculator. In there you can build your expression, and it will then run the calculation for all records. If there's more to it than that (and maybe anyway) you might want to take a look at this question, which has some links to add-in and other tools that do it.
    – Chris W
    Jul 5, 2014 at 18:38
  • I agree with @ChrisW that Field Calculator is the place to start. If you edit your question to include the formula then we should be able to advise further from there. The question he linked to also looks like a near duplicate of this.
    – PolyGeo
    Jul 5, 2014 at 20:35
  • @PolyGeo If I read the linked question correctly, the image in the answer there gives the right forumla (wich I also saw at the Wiki), but it's more a question about the data. Asker states "each individual segment", but I'm unclear if that means two-point segments or that each segment may in turn have multiple segments/more than two vertices - my guess is the latter based on "(polyline)". In that case Field calculator needs an input n which is the segment count that make up the polyline for one record - and I don't know how/if that can be accessed within field calculator.
    – Chris W
    Jul 5, 2014 at 20:55
  • @ChrisW To get the segment count !shape!.pointcount - 1 could be used support.esri.com/en/knowledgebase/techarticles/detail/38864 - even if the formula is in a linked question, if it is key to this question then I think it should be included here to enable it to standalone.
    – PolyGeo
    Jul 5, 2014 at 21:02
  • @PolyGeo Agreed - I can see two options. 1) include the formula here with the question refined to use of field calculator. 2) make this a duplicate of the other and add an answer of how to do it in the field calculator (which is not currently there). That may require using the pre-logic code block. Assuming the same formula, length would be !shape!.length (or equivilent?), and that just leaves the straight-line distance between the first and last vertex to figure out and incorporate in the formula. I lean toward option 2...
    – Chris W
    Jul 5, 2014 at 21:22

2 Answers 2


You could try the VLATE landscape metrics extension for ArcGIS. It operates on vectors and one of the metrics if fractal dimension.

  • Hi Jeffrey, The VLATE extension seems only to work for polygons. My shape file is polylines. The error I get is: "A polygon shapefile must be selected before running this script."
    – Maha
    Jul 7, 2014 at 21:51

Have you tried the Minkowski Dimension Calculator plug-in? I see it was updated for QGIS 3 earlier this year. It works with linestrings.

The plugin's home page is: http://ekazakov.info/projects/mdc_tutorial.html

It is also in the official QGIS repository (where I found it)

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.