3

I have a shapefile containing features (line) and I have a UTM grid in the same area. The feature is a coastline with different types. Now I would like to produce the length of coastline and the length of each type within each UTM grid cell. I prefer using Python or QGIS/SAGA GIS.

I found the post on how to create my UTM grid and I have the shapefile but how do I compute the fractions?

UMY
  • 91
  • 3

1 Answers1

1

I would probably do the following (assuming your UTM grid are polygons, if not then you can convert it using the Lines to polygons tool):

  1. Run the Intersection tool with the line layer as Input layer and your polygon grid layer as the Intersect layer. This should output your line layer but split into each grid.

  2. Run the Field Calculator on the output and create a new field with the expression $length to calculate the length of coast line within each grid.

  3. Run the GroupStats plugin to calculate the sum of the length for each type of coast line (similar method as described in this post: Calculating sum of parts of column based on another column using QGIS Field Calculator?).

Joseph
  • 75,746
  • 7
  • 171
  • 282