2

I have 7 shapefiles, each representing a year, all containing lots of polygons (c. 500,000). My aim is to take any 2 of them and compare how they have changed in terms of size and shape of polygon. (i am willing to split into much smaller tiles of course)

Also, each polygon has an ID so I want to see over the years how the geometry has changed for a particular polygon.

I've tried quite a few tools, intersections, duplications etc etc but nothing seems to quite work (or simply produces errors)

any ideas?

5
  • 4
    What GIS software, version and, if applicable, license level do you have access to in order to do this?
    – PolyGeo
    Commented Dec 10, 2013 at 10:14
  • 1
    You must be more specific about how do you plan to compare them? Visually? or in term of attributes? Apart from that, if you are into it, putting your data in a Postgis\Postgres database, will give you lots of power. You can create some SQL queries to compare a feature (using the ID) along the 7 years then just change the ID to filter the feature you want to compare. Commented Dec 10, 2013 at 12:11
  • Or simply in SQLite (with or without GDAL/OGR). Commented Dec 10, 2013 at 12:15
  • Sorry, lack of specifics :- ArcGIS 10.1 SP1 (build 3143) with access to most (if not all) extensions. visual comparison is fine as it is but due to their size is fairly redundant/time consuming. Attribute comparison is key. Each polygon has a specific ID so changing area is one comparison (not too hard i grant you). Another is to which polygons has area been lost to or gained from? When an entirely new polygon is created (i.e where the ID has not existed in any previous year), which polygons has that taken area from? (or is it all new, previously unused space?)
    – Sam
    Commented Dec 10, 2013 at 12:19
  • also, if anyone has experience of using Change Detector (or any other transformer) in FME i'd be grateful
    – Sam
    Commented Dec 10, 2013 at 12:28

2 Answers 2

0

The Symmetric Difference operation shows areas were polygons do not coincide. You'd want to do this operation between the original and modified feature classes.

Symmetrical difference in ArcGIS

2
  • yes, this does provide areas that have decreased/increased, i've had a play with this. I think I need to somehow combine identity tool as I also need the make up of a polygon compared to another year (if it has changed). E.g. if a polygon in 2012 has shifted it's boundaries compared to 2011, i need to see the new percentage make up in 2012 of the various polygons form 2011
    – Sam
    Commented Dec 10, 2013 at 12:14
  • Area of symmetric difference between two polygons can be used as a measurement of magnitude of change. You could also apply Difference tool twice: A - B and B - A. That'll let you distinguish between what changed where. The Symmetric difference can be thought of as a result of Dissolve of two Difference operations.
    – 0kcats
    Commented Dec 10, 2013 at 12:40
0

I'd use the following approach with GDAL: Multiple input shapefiles for ogr2ogr sqlite spatial operations
In detail, considering only two different years for brevity (but they could be all the seven years all together, as well), I'd wrap the layers in a VRT file like this (e.g. data.vrt):

<OGRVRTDataSource>
    <OGRVRTlayer name="shp2012">
        <SrcDataSource>shp2012.shp</SrcDataSource>
        <SrcSQL dialect="sqlite">SELECT ID, ST_AREA(geometry) AS area2012, ST_LENGTH(geometry) AS peri2012, ST_LENGTH(geometry)/ST_AREA(geometry) AS para2012 FROM shp2012</SrcSQL>
    </OGRVRTlayer>
    <OGRVRTlayer name="shp2013">
        <SrcDataSource>shp2013.shp</SrcDataSource>
        <SrcSQL dialect="sqlite">SELECT ID, ST_AREA(geometry) AS area2013, ST_LENGTH(geometry) AS peri2013, ST_LENGTH(geometry)/ST_AREA(geometry) AS para2013 FROM shp2013</SrcSQL>
    </OGRVRTlayer>
</OGRVRTDataSource>

Area, perimeter and a very simple shape index, i.e. the perimeter-area ratio (PARA) are calculated in the SrcSQL subelement for each layer. Then, it's possible to calculate the deltas of area, perimeter and PARA between the two years and store the results in a DBF file:

ogr2ogr diff_2013_2012.dbf data.vrt -dialect sqlite -sql "SELECT *, area2013-area2012 AS delta_area, peri2013-peri2012 AS delta_peri, para2013-para2012 AS delta_para FROM shp2013, shp2012 WHERE shp2013.ID = shp2012.ID"

Finally, the result DBF file could be joined with the geometries of the year you like.

Note: In case we have to consider also the shifts or rotation of geometries, we could select also their bounding box (extent) WKT representation, i.e. AsWKT(Extent(geometry)), to be calculated in the VRT file. Finally, we have to check if WKT are the same or not within the ogr2ogr command. The idea is to provide a simple boolean field, e.g. DIFFERENT, which synthesize all the considered shape indices (and extent WKT, as well).

4
  • Some changes would not change area and length. Consider shift or rotation among the most obvious ones.
    – 0kcats
    Commented Dec 10, 2013 at 12:23
  • @0kcats I've just added a note in the answer in order to do that. ;) Commented Dec 10, 2013 at 14:57
  • @afalciano How about rotation around the centroid? It is impossible to describe arbitrary change of polygon shape with a few parameters.
    – 0kcats
    Commented Dec 10, 2013 at 15:50
  • @0kcats ...you're right! However, in case of meaningful rotation, extent can vary. So we need simply to check its WKT representation together with the other indices. Commented Dec 10, 2013 at 16:29

Not the answer you're looking for? Browse other questions tagged or ask your own question.