By Christy Pruett


2019-03-14 20:50:34 8 Comments

I use QGIS 2.18 and I have a point shapefile of many animal locations and a shapefile of roads.

I want to use QGIS to tell me how many roads are between each pair of animal locations.

So, basically how many roads would they have to cross to get to the other point.

1 comments

@snaileater 2019-03-15 14:44:29

In Database / Database Manager / Database Manager then Virtual Layers / Qgis Layers you can try the following query to create your line layer :

select a.id, b.id, make_line(st_centroid(a.geometry),st_centroid(b.geometry)) as line from animal_locations a, animal_locations b
where a.id>b.id

you save the result (Care about the size of your dataset) ...

Then, as @csk indicated, you edit this layer by adding a virtual field using the following expression :

intersecting_geom_count('roads_layer_name')

RefFunction plug-in required to access this expression ... And you should have the answer you're seeking.

Related Questions

Sponsored Content

1 Answered Questions

1 Answered Questions

1 Answered Questions

[SOLVED] Measure distance between points along a line in QGIS

1 Answered Questions

[SOLVED] Number of buildings between two points

  • 2017-10-31 16:04:30
  • Hajar Elhammouti
  • 154 View
  • 4 Score
  • 1 Answer
  • Tags:   qgis

2 Answered Questions

0 Answered Questions

How to find road distance between points from two shapefiles in QGIS

  • 2017-05-07 16:24:18
  • Caroline
  • 166 View
  • 1 Score
  • 0 Answer
  • Tags:   qgis distance road

1 Answered Questions

[SOLVED] QGIS: calculate distance between points

1 Answered Questions

[SOLVED] Create lines between two points, given an ID

1 Answered Questions

[SOLVED] How to creat multiple rings between two circular buffers?

  • 2014-05-04 19:17:05
  • Paulo Pimenta
  • 402 View
  • 3 Score
  • 1 Answer
  • Tags:   qgis buffer

0 Answered Questions

Highlight paths between two points

  • 2014-05-26 09:55:14
  • Ramanayake
  • 188 View
  • 1 Score
  • 0 Answer
  • Tags:   qgis python

Sponsored Content