Skip to content

Commit 2ec429c

Browse files
committed
[FEATURE][processing] New algorithm "Overlap analysis"
This algorithm calculates the area and percentage cover by which features from an input layer are overlapped by features from a selection of overlay layers. New attributes are added to the output layer reporting the total area of overlap and percentage of the input feature overlapped by each of the selected overlay layers. This is quite a common GIS task request, yet is full of traps for inexperienced users, and the amount of manual data work usually done by users to calculate these figures can often lead to mistakes and inaccurate results. It's nice to have a robust, fast, inbuilt algorithm which allows this task to be done in a single step without risk of human error.
1 parent 56a6edf commit 2ec429c

14 files changed

Lines changed: 1116 additions & 0 deletions
Binary file not shown.
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<ogr:FeatureCollection
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://ogr.maptools.org/ overlay0_4326.xsd"
5+
xmlns:ogr="http://ogr.maptools.org/"
6+
xmlns:gml="http://www.opengis.net/gml">
7+
<gml:boundedBy>
8+
<gml:Box>
9+
<gml:coord><gml:X>8.983152841195214e-06</gml:X><gml:Y>8.983152840993819e-06</gml:Y></gml:coord>
10+
<gml:coord><gml:X>8.983152841195213e-05</gml:X><gml:Y>0.0001437304454559011</gml:Y></gml:coord>
11+
</gml:Box>
12+
</gml:boundedBy>
13+
14+
<gml:featureMember>
15+
<ogr:overlay0_4326 fid="overlay0_4326.0">
16+
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>0.000008983152841,0.000008983152841 0.000044915764206,0.000008983152841 0.000044915764206,0.000044915764205 0.000008983152841,0.000044915764205 0.000008983152841,0.000008983152841</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
17+
<ogr:id_a>A1</ogr:id_a>
18+
</ogr:overlay0_4326>
19+
</gml:featureMember>
20+
<gml:featureMember>
21+
<ogr:overlay0_4326 fid="overlay0_4326.1">
22+
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>0.000017966305682,0.000017966305682 0.000035932611365,0.000017966305682 0.000035932611365,0.000035932611364 0.000017966305682,0.000035932611364 0.000017966305682,0.000017966305682</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
23+
<ogr:id_a>A2</ogr:id_a>
24+
</ogr:overlay0_4326>
25+
</gml:featureMember>
26+
<gml:featureMember>
27+
<ogr:overlay0_4326 fid="overlay0_4326.2">
28+
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>0.000062882069888,0.000017966305682 0.000080848375571,0.000017966305682 0.000080848375571,0.000035932611364 0.000062882069888,0.000035932611364 0.000062882069888,0.000017966305682</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
29+
<ogr:id_a>A3</ogr:id_a>
30+
</ogr:overlay0_4326>
31+
</gml:featureMember>
32+
<gml:featureMember>
33+
<ogr:overlay0_4326 fid="overlay0_4326.3">
34+
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>0.000053898917047,0.000008983152841 0.000089831528412,0.000008983152841 0.000089831528412,0.000044915764205 0.000053898917047,0.000044915764205 0.000053898917047,0.000008983152841</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
35+
<ogr:id_a>A4</ogr:id_a>
36+
</ogr:overlay0_4326>
37+
</gml:featureMember>
38+
<gml:featureMember>
39+
<ogr:overlay0_4326 fid="overlay0_4326.4">
40+
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>0.000008983152841,0.000053898917046 0.000026949458524,0.000053898917046 0.000026949458524,0.00008983152841 0.000008983152841,0.00008983152841 0.000008983152841,0.000053898917046</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
41+
<ogr:id_a>A5</ogr:id_a>
42+
</ogr:overlay0_4326>
43+
</gml:featureMember>
44+
<gml:featureMember>
45+
<ogr:overlay0_4326 fid="overlay0_4326.5">
46+
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>0.000026949458524,0.000053898917046 0.000044915764206,0.000053898917046 0.000044915764206,0.00008983152841 0.000026949458524,0.00008983152841 0.000026949458524,0.000053898917046</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
47+
<ogr:id_a>A6</ogr:id_a>
48+
</ogr:overlay0_4326>
49+
</gml:featureMember>
50+
<gml:featureMember>
51+
<ogr:overlay0_4326 fid="overlay0_4326.6">
52+
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>0.000053898917047,0.000053898917046 0.000089831528412,0.000053898917046 0.000089831528412,0.00008983152841 0.000053898917047,0.00008983152841 0.000053898917047,0.000053898917046</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
53+
<ogr:id_a>A7</ogr:id_a>
54+
</ogr:overlay0_4326>
55+
</gml:featureMember>
56+
<gml:featureMember>
57+
<ogr:overlay0_4326 fid="overlay0_4326.7">
58+
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>0.000008983152841,0.000098814681251 0.000035932611365,0.000098814681251 0.000035932611365,0.000125764139774 0.000008983152841,0.000125764139774 0.000008983152841,0.000098814681251</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
59+
<ogr:id_a>A8</ogr:id_a>
60+
</ogr:overlay0_4326>
61+
</gml:featureMember>
62+
<gml:featureMember>
63+
<ogr:overlay0_4326 fid="overlay0_4326.8">
64+
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>0.000008983152841,0.000116780986933 0.000035932611365,0.000116780986933 0.000035932611365,0.000143730445456 0.000008983152841,0.000143730445456 0.000008983152841,0.000116780986933</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
65+
<ogr:id_a>A9</ogr:id_a>
66+
</ogr:overlay0_4326>
67+
</gml:featureMember>
68+
<gml:featureMember>
69+
<ogr:overlay0_4326 fid="overlay0_4326.9">
70+
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>0.000017966305682,0.000107797834092 0.000044915764206,0.000107797834092 0.000044915764206,0.000134747292615 0.000017966305682,0.000134747292615 0.000017966305682,0.000107797834092</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
71+
<ogr:id_a>A10</ogr:id_a>
72+
</ogr:overlay0_4326>
73+
</gml:featureMember>
74+
<gml:featureMember>
75+
<ogr:overlay0_4326 fid="overlay0_4326.10">
76+
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>0.000053898917047,0.000098814681251 0.000089831528412,0.000098814681251 0.000089831528412,0.000107797834092 0.000062882069888,0.000107797834092 0.000062882069888,0.000134747292615 0.000053898917047,0.000134747292615 0.000053898917047,0.000098814681251</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
77+
<ogr:id_a>A11</ogr:id_a>
78+
</ogr:overlay0_4326>
79+
</gml:featureMember>
80+
<gml:featureMember>
81+
<ogr:overlay0_4326 fid="overlay0_4326.11">
82+
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>0.00007186522273,0.000116780986933 0.000089831528412,0.000116780986933 0.000089831528412,0.000134747292615 0.00007186522273,0.000134747292615 0.00007186522273,0.000116780986933</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
83+
<ogr:id_a>A12</ogr:id_a>
84+
</ogr:overlay0_4326>
85+
</gml:featureMember>
86+
</ogr:FeatureCollection>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<xs:schema targetNamespace="http://ogr.maptools.org/" xmlns:ogr="http://ogr.maptools.org/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:gml="http://www.opengis.net/gml" elementFormDefault="qualified" version="1.0">
3+
<xs:import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengis.net/gml/2.1.2/feature.xsd"/>
4+
<xs:element name="FeatureCollection" type="ogr:FeatureCollectionType" substitutionGroup="gml:_FeatureCollection"/>
5+
<xs:complexType name="FeatureCollectionType">
6+
<xs:complexContent>
7+
<xs:extension base="gml:AbstractFeatureCollectionType">
8+
<xs:attribute name="lockId" type="xs:string" use="optional"/>
9+
<xs:attribute name="scope" type="xs:string" use="optional"/>
10+
</xs:extension>
11+
</xs:complexContent>
12+
</xs:complexType>
13+
<xs:element name="overlay0_4326" type="ogr:overlay0_4326_Type" substitutionGroup="gml:_Feature"/>
14+
<xs:complexType name="overlay0_4326_Type">
15+
<xs:complexContent>
16+
<xs:extension base="gml:AbstractFeatureType">
17+
<xs:sequence>
18+
<xs:element name="geometryProperty" type="gml:PolygonPropertyType" nillable="true" minOccurs="0" maxOccurs="1"/>
19+
<xs:element name="id_a" nillable="true" minOccurs="0" maxOccurs="1">
20+
<xs:simpleType>
21+
<xs:restriction base="xs:string">
22+
</xs:restriction>
23+
</xs:simpleType>
24+
</xs:element>
25+
</xs:sequence>
26+
</xs:extension>
27+
</xs:complexContent>
28+
</xs:complexType>
29+
</xs:schema>
0 Bytes
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)