Banner_2.png
[   RESOURCES   ]
VinzeroLogo_reverse.png

QGIS – Constraint Checker

March 22, 2022 By David Crowther


Question:

How can I quickly run constraint checks within QGIS?


Answer:

The ability to run spatial queries to understand any constraints on your data is a key advantage of GIS software.


Indeed, Cadline have implemented this functionality within our webGIS – MapThat – as our Report Generator tool:


https://www.cadlinecommunity.co.uk/hc/en-us/articles/360018942637-MapThat-Report-Generator-Con29-made-easy-


However, you can also run these queries within QGIS using a plugin called the Constraint Checker.


From the Plugins menu choose > Manage and Install Plugins and search for Constraint.

Tick and then choose Install Plugin and the Constraint Checker will be added into the Plugins menu.

Firstly, choose to Edit the the Configuration.

Choose the source of your spatial data. This will need to be a PostGIS database. Also, ensure that your source datasets and map canvas all have the same SRID so that analysis is accurate e.g. BNG 27700.


In this example we will connect to the Cadline TryDynamicMaps PostGIS database.

Next, one by one, add in each Constraint. In the first example we will add a Constraint check on our Conservation Areaslayer in the PostGIS database.

Settings are:

  • Constraint – the name of the Constraint e.g., Conservation Area Checking

  • Schema – the Schema in your PostGIS database that has the source table e.g. Public

  • Table – the PostGIS table name e.g. conservation_areas

  • Geometry Column – the geometry column name for the source table e.g. geom

  • Search Distance – apply a search distance to the query e.g. 10 so that the constraint will check if there are any features within a set distance e.g. 10metres

  • Columns for Reporting - choose any number of fields from the source table to add to the output report e.g. name, type etc…

To run the Constraint Checker, you can either select an existing map feature or choose to find any constraints on an area that you draw freehand.


Check Constraints for Freehand Polygon


In the map window draw a polygon for the area that you wish to run the Constraint Checker for, ending the freehand polygon by right clicking.

Give the Constraint Check a Reference Number e.g. 1.

When you press OK, the Constraint Checker runs and generates the Constraint Results.

The results list all the Conservation Areas that intersect the freehand polygon, with a line item for each Conservation Area. The results have been configured so that the Area Name and the Type for the intersected Conservation Area has been exported.


The results of the report can then be exported to a CSV file.

This time we will add a second environmental constraint check for Open Spaces.

Note – you can save Constraint Checker settings by exporting the settings to an INI file, which can then be imported again whenever you wish to run the same report.

Check Constraints for Existing Polygon


This time we will check for any environmental constraints that affect an existing polygon. In the map we have loaded in the Ward boundaries and selected our chosen Ward.

From the Plugins menu > Choose Constraint Checker > Check for Constraints for Existing Polygon > giving the Report a number.

When you press OK, the Constraint Checker runs and generates the Constraint Results.

The result lists all the Conservation Areas and Open Spaces that intersect the chosen Ward boundary, with a line item for each constraint.


Exporting to CSV will then allow you to view the Environmental Constraints within an Excel file.

The Constraint Checker plugin for QGIS will enable you to run complex spatial analysis against multiple layers in just a few seconds. Using the Export and Import settings you can choose to save and then run any number of Constraint checks e.g. Environmental, Land Charges, Planning etc…. on any of your datasets or chosen geographic boundaries.


homepage_bg.jpg
[   VINZERO. RETHINK & LEVERAGE   ]

Explore our Think Community.

VinZero's Think Future Podcast

Coming Soon!

See how other companies are working towards net zero

Case studies and blogs featuring VinZero in Action around the globe

Live webinars that allow you to learn at a time that suits you

Create your own Think Folder of favourite resources