Nyall Dawson 2ec429cb89 [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.
2019-05-14 06:13:10 +10:00

231 lines
17 KiB
XML

<?xml version="1.0" encoding="utf-8" ?>
<ogr:FeatureCollection
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://ogr.maptools.org/ overlap_analysis_1.xsd"
xmlns:ogr="http://ogr.maptools.org/"
xmlns:gml="http://www.opengis.net/gml">
<gml:boundedBy>
<gml:Box>
<gml:coord><gml:X>1</gml:X><gml:Y>1</gml:Y></gml:coord>
<gml:coord><gml:X>10</gml:X><gml:Y>16</gml:Y></gml:coord>
</gml:Box>
</gml:boundedBy>
<gml:featureMember>
<ogr:overlap_analysis_1 fid="overlap_analysis_1.0">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:3857"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>1,1 5,1 5,5 1,5 1,1</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:id_a>A1</ogr:id_a>
<ogr:custom_overlay1_a.geojson_area>2.9799168600681</ogr:custom_overlay1_a.geojson_area>
<ogr:custom_overlay1_a.geojson_pc>18.7500000016825</ogr:custom_overlay1_a.geojson_pc>
<ogr:custom_overlay1_b.geojson_area>3.97322247866466</ogr:custom_overlay1_b.geojson_area>
<ogr:custom_overlay1_b.geojson_pc>24.99999999327</ogr:custom_overlay1_b.geojson_pc>
<ogr:custom_overlay2_a.geojson_area>3.97322248080386</ogr:custom_overlay2_a.geojson_area>
<ogr:custom_overlay2_a.geojson_pc>25.00000000673</ogr:custom_overlay2_a.geojson_pc>
<ogr:custom_overlay2_b.geojson_area>2.97991686113769</ogr:custom_overlay2_b.geojson_area>
<ogr:custom_overlay2_b.geojson_pc>18.7500000084126</ogr:custom_overlay2_b.geojson_pc>
<ogr:custom_overlay3_a.geojson_area>2.9799168589985</ogr:custom_overlay3_a.geojson_area>
<ogr:custom_overlay3_a.geojson_pc>18.7499999949525</ogr:custom_overlay3_a.geojson_pc>
<ogr:custom_overlay3_b.geojson_area>5.46318090923351</ogr:custom_overlay3_b.geojson_area>
<ogr:custom_overlay3_b.geojson_pc>34.3749999974762</ogr:custom_overlay3_b.geojson_pc>
</ogr:overlap_analysis_1>
</gml:featureMember>
<gml:featureMember>
<ogr:overlap_analysis_1 fid="overlap_analysis_1.1">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:3857"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>2,2 4,2 4,4 2,4 2,2</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:id_a>A2</ogr:id_a>
<ogr:custom_overlay1_a.geojson_area>0.993305619666166</ogr:custom_overlay1_a.geojson_area>
<ogr:custom_overlay1_a.geojson_pc>25</ogr:custom_overlay1_a.geojson_pc>
<ogr:custom_overlay1_b.geojson_area>0</ogr:custom_overlay1_b.geojson_area>
<ogr:custom_overlay1_b.geojson_pc>0</ogr:custom_overlay1_b.geojson_pc>
<ogr:custom_overlay2_a.geojson_area>0.993305619666166</ogr:custom_overlay2_a.geojson_area>
<ogr:custom_overlay2_a.geojson_pc>25</ogr:custom_overlay2_a.geojson_pc>
<ogr:custom_overlay2_b.geojson_area>0</ogr:custom_overlay2_b.geojson_area>
<ogr:custom_overlay2_b.geojson_pc>0</ogr:custom_overlay2_b.geojson_pc>
<ogr:custom_overlay3_a.geojson_area>1.98661123933233</ogr:custom_overlay3_a.geojson_area>
<ogr:custom_overlay3_a.geojson_pc>50</ogr:custom_overlay3_a.geojson_pc>
<ogr:custom_overlay3_b.geojson_area>0.993305619666166</ogr:custom_overlay3_b.geojson_area>
<ogr:custom_overlay3_b.geojson_pc>25</ogr:custom_overlay3_b.geojson_pc>
</ogr:overlap_analysis_1>
</gml:featureMember>
<gml:featureMember>
<ogr:overlap_analysis_1 fid="overlap_analysis_1.2">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:3857"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>7,2 9,2 9,4 7,4 7,2</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:id_a>A3</ogr:id_a>
<ogr:custom_overlay1_a.geojson_area>0</ogr:custom_overlay1_a.geojson_area>
<ogr:custom_overlay1_a.geojson_pc>0</ogr:custom_overlay1_a.geojson_pc>
<ogr:custom_overlay1_b.geojson_area>1.98661123933233</ogr:custom_overlay1_b.geojson_area>
<ogr:custom_overlay1_b.geojson_pc>50</ogr:custom_overlay1_b.geojson_pc>
<ogr:custom_overlay2_a.geojson_area>0</ogr:custom_overlay2_a.geojson_area>
<ogr:custom_overlay2_a.geojson_pc>0</ogr:custom_overlay2_a.geojson_pc>
<ogr:custom_overlay2_b.geojson_area>0</ogr:custom_overlay2_b.geojson_area>
<ogr:custom_overlay2_b.geojson_pc>0</ogr:custom_overlay2_b.geojson_pc>
<ogr:custom_overlay3_a.geojson_area>0</ogr:custom_overlay3_a.geojson_area>
<ogr:custom_overlay3_a.geojson_pc>0</ogr:custom_overlay3_a.geojson_pc>
<ogr:custom_overlay3_b.geojson_area>1.98661123933233</ogr:custom_overlay3_b.geojson_area>
<ogr:custom_overlay3_b.geojson_pc>50</ogr:custom_overlay3_b.geojson_pc>
</ogr:overlap_analysis_1>
</gml:featureMember>
<gml:featureMember>
<ogr:overlap_analysis_1 fid="overlap_analysis_1.3">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:3857"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>6,1 10,1 10,5 6,5 6,1</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:id_a>A4</ogr:id_a>
<ogr:custom_overlay1_a.geojson_area>0</ogr:custom_overlay1_a.geojson_area>
<ogr:custom_overlay1_a.geojson_pc>0</ogr:custom_overlay1_a.geojson_pc>
<ogr:custom_overlay1_b.geojson_area>4.96652809940043</ogr:custom_overlay1_b.geojson_area>
<ogr:custom_overlay1_b.geojson_pc>31.2499999983175</ogr:custom_overlay1_b.geojson_pc>
<ogr:custom_overlay2_a.geojson_area>0</ogr:custom_overlay2_a.geojson_area>
<ogr:custom_overlay2_a.geojson_pc>0</ogr:custom_overlay2_a.geojson_pc>
<ogr:custom_overlay2_b.geojson_area>0.993305620735764</ogr:custom_overlay2_b.geojson_area>
<ogr:custom_overlay2_b.geojson_pc>6.25000000504753</ogr:custom_overlay2_b.geojson_pc>
<ogr:custom_overlay3_a.geojson_area>0.993305619666166</ogr:custom_overlay3_a.geojson_area>
<ogr:custom_overlay3_a.geojson_pc>6.24999999831749</ogr:custom_overlay3_a.geojson_pc>
<ogr:custom_overlay3_b.geojson_area>2.9799168589985</ogr:custom_overlay3_b.geojson_area>
<ogr:custom_overlay3_b.geojson_pc>18.7499999949525</ogr:custom_overlay3_b.geojson_pc>
</ogr:overlap_analysis_1>
</gml:featureMember>
<gml:featureMember>
<ogr:overlap_analysis_1 fid="overlap_analysis_1.4">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:3857"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>1,6 3,6 3,10 1,10 1,6</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:id_a>A5</ogr:id_a>
<ogr:custom_overlay1_a.geojson_area>3.97322247973426</ogr:custom_overlay1_a.geojson_area>
<ogr:custom_overlay1_a.geojson_pc>50</ogr:custom_overlay1_a.geojson_pc>
<ogr:custom_overlay1_b.geojson_area>0</ogr:custom_overlay1_b.geojson_area>
<ogr:custom_overlay1_b.geojson_pc>0</ogr:custom_overlay1_b.geojson_pc>
<ogr:custom_overlay2_a.geojson_area>0</ogr:custom_overlay2_a.geojson_area>
<ogr:custom_overlay2_a.geojson_pc>0</ogr:custom_overlay2_a.geojson_pc>
<ogr:custom_overlay2_b.geojson_area>0</ogr:custom_overlay2_b.geojson_area>
<ogr:custom_overlay2_b.geojson_pc>0</ogr:custom_overlay2_b.geojson_pc>
<ogr:custom_overlay3_a.geojson_area>0</ogr:custom_overlay3_a.geojson_area>
<ogr:custom_overlay3_a.geojson_pc>0</ogr:custom_overlay3_a.geojson_pc>
<ogr:custom_overlay3_b.geojson_area>0</ogr:custom_overlay3_b.geojson_area>
<ogr:custom_overlay3_b.geojson_pc>0</ogr:custom_overlay3_b.geojson_pc>
</ogr:overlap_analysis_1>
</gml:featureMember>
<gml:featureMember>
<ogr:overlap_analysis_1 fid="overlap_analysis_1.5">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:3857"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>3,6 5,6 5,10 3,10 3,6</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:id_a>A6</ogr:id_a>
<ogr:custom_overlay1_a.geojson_area>0</ogr:custom_overlay1_a.geojson_area>
<ogr:custom_overlay1_a.geojson_pc>0</ogr:custom_overlay1_a.geojson_pc>
<ogr:custom_overlay1_b.geojson_area>1.98661123933233</ogr:custom_overlay1_b.geojson_area>
<ogr:custom_overlay1_b.geojson_pc>24.99999999327</ogr:custom_overlay1_b.geojson_pc>
<ogr:custom_overlay2_a.geojson_area>1.98661123933233</ogr:custom_overlay2_a.geojson_area>
<ogr:custom_overlay2_a.geojson_pc>24.99999999327</ogr:custom_overlay2_a.geojson_pc>
<ogr:custom_overlay2_b.geojson_area>0</ogr:custom_overlay2_b.geojson_area>
<ogr:custom_overlay2_b.geojson_pc>0</ogr:custom_overlay2_b.geojson_pc>
<ogr:custom_overlay3_a.geojson_area>0</ogr:custom_overlay3_a.geojson_area>
<ogr:custom_overlay3_a.geojson_pc>0</ogr:custom_overlay3_a.geojson_pc>
<ogr:custom_overlay3_b.geojson_area>0</ogr:custom_overlay3_b.geojson_area>
<ogr:custom_overlay3_b.geojson_pc>0</ogr:custom_overlay3_b.geojson_pc>
</ogr:overlap_analysis_1>
</gml:featureMember>
<gml:featureMember>
<ogr:overlap_analysis_1 fid="overlap_analysis_1.6">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:3857"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>6,6 10,6 10,10 6,10 6,6</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:id_a>A7</ogr:id_a>
<ogr:custom_overlay1_a.geojson_area>2.9799168589985</ogr:custom_overlay1_a.geojson_area>
<ogr:custom_overlay1_a.geojson_pc>18.7499999949525</ogr:custom_overlay1_a.geojson_pc>
<ogr:custom_overlay1_b.geojson_area>2.9799168600681</ogr:custom_overlay1_b.geojson_area>
<ogr:custom_overlay1_b.geojson_pc>18.7500000016825</ogr:custom_overlay1_b.geojson_pc>
<ogr:custom_overlay2_a.geojson_area>0</ogr:custom_overlay2_a.geojson_area>
<ogr:custom_overlay2_a.geojson_pc>0</ogr:custom_overlay2_a.geojson_pc>
<ogr:custom_overlay2_b.geojson_area>0</ogr:custom_overlay2_b.geojson_area>
<ogr:custom_overlay2_b.geojson_pc>0</ogr:custom_overlay2_b.geojson_pc>
<ogr:custom_overlay3_a.geojson_area>0</ogr:custom_overlay3_a.geojson_area>
<ogr:custom_overlay3_a.geojson_pc>0</ogr:custom_overlay3_a.geojson_pc>
<ogr:custom_overlay3_b.geojson_area>0</ogr:custom_overlay3_b.geojson_area>
<ogr:custom_overlay3_b.geojson_pc>0</ogr:custom_overlay3_b.geojson_pc>
</ogr:overlap_analysis_1>
</gml:featureMember>
<gml:featureMember>
<ogr:overlap_analysis_1 fid="overlap_analysis_1.7">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:3857"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>1,11 4,11 4,14 1,14 1,11</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:id_a>A8</ogr:id_a>
<ogr:custom_overlay1_a.geojson_area>0</ogr:custom_overlay1_a.geojson_area>
<ogr:custom_overlay1_a.geojson_pc>0</ogr:custom_overlay1_a.geojson_pc>
<ogr:custom_overlay1_b.geojson_area>0</ogr:custom_overlay1_b.geojson_area>
<ogr:custom_overlay1_b.geojson_pc>0</ogr:custom_overlay1_b.geojson_pc>
<ogr:custom_overlay2_a.geojson_area>0</ogr:custom_overlay2_a.geojson_area>
<ogr:custom_overlay2_a.geojson_pc>0</ogr:custom_overlay2_a.geojson_pc>
<ogr:custom_overlay2_b.geojson_area>0</ogr:custom_overlay2_b.geojson_area>
<ogr:custom_overlay2_b.geojson_pc>0</ogr:custom_overlay2_b.geojson_pc>
<ogr:custom_overlay3_a.geojson_area>0</ogr:custom_overlay3_a.geojson_area>
<ogr:custom_overlay3_a.geojson_pc>0</ogr:custom_overlay3_a.geojson_pc>
<ogr:custom_overlay3_b.geojson_area>0</ogr:custom_overlay3_b.geojson_area>
<ogr:custom_overlay3_b.geojson_pc>0</ogr:custom_overlay3_b.geojson_pc>
</ogr:overlap_analysis_1>
</gml:featureMember>
<gml:featureMember>
<ogr:overlap_analysis_1 fid="overlap_analysis_1.8">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:3857"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>1,13 4,13 4,16 1,16 1,13</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:id_a>A9</ogr:id_a>
<ogr:custom_overlay1_a.geojson_area>0</ogr:custom_overlay1_a.geojson_area>
<ogr:custom_overlay1_a.geojson_pc>0</ogr:custom_overlay1_a.geojson_pc>
<ogr:custom_overlay1_b.geojson_area>0</ogr:custom_overlay1_b.geojson_area>
<ogr:custom_overlay1_b.geojson_pc>0</ogr:custom_overlay1_b.geojson_pc>
<ogr:custom_overlay2_a.geojson_area>0</ogr:custom_overlay2_a.geojson_area>
<ogr:custom_overlay2_a.geojson_pc>0</ogr:custom_overlay2_a.geojson_pc>
<ogr:custom_overlay2_b.geojson_area>0</ogr:custom_overlay2_b.geojson_area>
<ogr:custom_overlay2_b.geojson_pc>0</ogr:custom_overlay2_b.geojson_pc>
<ogr:custom_overlay3_a.geojson_area>0</ogr:custom_overlay3_a.geojson_area>
<ogr:custom_overlay3_a.geojson_pc>0</ogr:custom_overlay3_a.geojson_pc>
<ogr:custom_overlay3_b.geojson_area>0</ogr:custom_overlay3_b.geojson_area>
<ogr:custom_overlay3_b.geojson_pc>0</ogr:custom_overlay3_b.geojson_pc>
</ogr:overlap_analysis_1>
</gml:featureMember>
<gml:featureMember>
<ogr:overlap_analysis_1 fid="overlap_analysis_1.9">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:3857"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>2,12 5,12 5,15 2,15 2,12</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:id_a>A10</ogr:id_a>
<ogr:custom_overlay1_a.geojson_area>0</ogr:custom_overlay1_a.geojson_area>
<ogr:custom_overlay1_a.geojson_pc>0</ogr:custom_overlay1_a.geojson_pc>
<ogr:custom_overlay1_b.geojson_area>0</ogr:custom_overlay1_b.geojson_area>
<ogr:custom_overlay1_b.geojson_pc>0</ogr:custom_overlay1_b.geojson_pc>
<ogr:custom_overlay2_a.geojson_area>0</ogr:custom_overlay2_a.geojson_area>
<ogr:custom_overlay2_a.geojson_pc>0</ogr:custom_overlay2_a.geojson_pc>
<ogr:custom_overlay2_b.geojson_area>0</ogr:custom_overlay2_b.geojson_area>
<ogr:custom_overlay2_b.geojson_pc>0</ogr:custom_overlay2_b.geojson_pc>
<ogr:custom_overlay3_a.geojson_area>0</ogr:custom_overlay3_a.geojson_area>
<ogr:custom_overlay3_a.geojson_pc>0</ogr:custom_overlay3_a.geojson_pc>
<ogr:custom_overlay3_b.geojson_area>0</ogr:custom_overlay3_b.geojson_area>
<ogr:custom_overlay3_b.geojson_pc>0</ogr:custom_overlay3_b.geojson_pc>
</ogr:overlap_analysis_1>
</gml:featureMember>
<gml:featureMember>
<ogr:overlap_analysis_1 fid="overlap_analysis_1.10">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:3857"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>6,11 10,11 10,12 7,12 7,15 6,15 6,11</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:id_a>A11</ogr:id_a>
<ogr:custom_overlay1_a.geojson_area>0</ogr:custom_overlay1_a.geojson_area>
<ogr:custom_overlay1_a.geojson_pc>0</ogr:custom_overlay1_a.geojson_pc>
<ogr:custom_overlay1_b.geojson_area>0</ogr:custom_overlay1_b.geojson_area>
<ogr:custom_overlay1_b.geojson_pc>0</ogr:custom_overlay1_b.geojson_pc>
<ogr:custom_overlay2_a.geojson_area>0</ogr:custom_overlay2_a.geojson_area>
<ogr:custom_overlay2_a.geojson_pc>0</ogr:custom_overlay2_a.geojson_pc>
<ogr:custom_overlay2_b.geojson_area>0</ogr:custom_overlay2_b.geojson_area>
<ogr:custom_overlay2_b.geojson_pc>0</ogr:custom_overlay2_b.geojson_pc>
<ogr:custom_overlay3_a.geojson_area>0</ogr:custom_overlay3_a.geojson_area>
<ogr:custom_overlay3_a.geojson_pc>0</ogr:custom_overlay3_a.geojson_pc>
<ogr:custom_overlay3_b.geojson_area>0</ogr:custom_overlay3_b.geojson_area>
<ogr:custom_overlay3_b.geojson_pc>0</ogr:custom_overlay3_b.geojson_pc>
</ogr:overlap_analysis_1>
</gml:featureMember>
<gml:featureMember>
<ogr:overlap_analysis_1 fid="overlap_analysis_1.11">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:3857"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>8,13 10,13 10,15 8,15 8,13</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:id_a>A12</ogr:id_a>
<ogr:custom_overlay1_a.geojson_area>0</ogr:custom_overlay1_a.geojson_area>
<ogr:custom_overlay1_a.geojson_pc>0</ogr:custom_overlay1_a.geojson_pc>
<ogr:custom_overlay1_b.geojson_area>0</ogr:custom_overlay1_b.geojson_area>
<ogr:custom_overlay1_b.geojson_pc>0</ogr:custom_overlay1_b.geojson_pc>
<ogr:custom_overlay2_a.geojson_area>0</ogr:custom_overlay2_a.geojson_area>
<ogr:custom_overlay2_a.geojson_pc>0</ogr:custom_overlay2_a.geojson_pc>
<ogr:custom_overlay2_b.geojson_area>0</ogr:custom_overlay2_b.geojson_area>
<ogr:custom_overlay2_b.geojson_pc>0</ogr:custom_overlay2_b.geojson_pc>
<ogr:custom_overlay3_a.geojson_area>0</ogr:custom_overlay3_a.geojson_area>
<ogr:custom_overlay3_a.geojson_pc>0</ogr:custom_overlay3_a.geojson_pc>
<ogr:custom_overlay3_b.geojson_area>0</ogr:custom_overlay3_b.geojson_area>
<ogr:custom_overlay3_b.geojson_pc>0</ogr:custom_overlay3_b.geojson_pc>
</ogr:overlap_analysis_1>
</gml:featureMember>
</ogr:FeatureCollection>