[GIS] count lines in polygons

qgisqgis-plugins

I found the following link to a post saying that a count lines in polygons had been added to ftools for QGIS:
http://hub.qgis.org/issues/4712

However I can't find how to access this feature nor any online discussion of how to do this – can anyone help?

Alternatively, are there any other tools that will allow this?

I have a hexagonal grid and want to count the number of animal track paths that go through each cell for a migratory distribution map.

Thanks

Best Answer

I couldn't find the field count in the fTools anymore (QGIS 2.0). But I managed to get the number of lines within a polygon using the plugin MMQGIS. Assuming you have a line layer test.shp and a polygonlayer buffers.shp you have to do the following:

Choose MMQGIS > Combine > Spatial Join

Select the parameters:

Output Shape (Target) Layer: buffer.shp

Spatial Operation: Intersects

Data (Join) Layer: test.shp

Attribute Operation: First

Output File: example.shp

The output file example.shp contains the attribute count, which gives you the number of lines within each polygon.

Related Question