Spatial queries are core to many types of GIS analysis. In QGIS, this functionality is available via the Spatial Query plugin.
We will be working with 2 datasets - a lines layer representing rivers and a point layer representing cities. The task is to run a spatial query to find all cities that are within 10 kms of a river.
We will use ne_10m_rivers_lake_centerlines and
10m_populated_places_simple datasets from Natural Earth.
Download Rivers and Lake Centerlines
Download Populated Places.
Data Source: [NATURALEARTH]
Shift key and click on both the zip files to select them.
Click Open.
ne_10m_rivers_lake_centerlines.shp and click OK.
10m_populated_places_simple layer and choose Save As.
populated_places_reprojected.shp. Next, click the
Browse button next to CRS.
Note
The World_Azimuthal_Equidistant projection spans 90 degrees from the origin. Here the origin being 0 degrees longitude, the only data contained within +/- 90 degrees longitude will be converted.
ne_10m_rivers_lake_centerlines
layer and save the new layer as rivers_lake_reprojected.shp.
populated_places_reprojected
layer as Input. Enter the buffer distance as 10000. Note that we want a
buffer of 10kms and since the CRS units are metres, we need to enter 10,000.
Enter the output file name as populated_places_buffer.shp. Click
OK.
rivers_lake_reprojected layer and
create an output file named rivers_lake_buffer.shp.
rivers_lake_buffer contains features that are both rivers as well as
lakes. Our analysis calls for using only river features, so we will run a
query to select only river features. Right-click on the
rivers_lake_buffer layer and select Open Attribute Table.
cities_near_river.kml.
This work is licensed under a Creative Commons Attribution 4.0 International License