2

I am trying to use R to compare the changes in shape of two multipolygon shapefiles. Specifically, these data are congressional districts from 2010 and 2013 in Wisconsin, so they have the same number of rows, with different shapes.

I am curious how I would compare these to each other to see how they have changed, similar to this question previously asked on here: Identifying differences in polygons across shape files.

So far I have only been able to read both shapefiles into R using the sf and rgdal packages.

2

There are functions in the sf package for doing geometric operations on polygons. For example st_difference(a,b) returns a-b, the parts of a that don't overlap b. If that has a substantial area (compute with st_area) or perimeter (st_length) then you know something has changed.

2

While you might have your good reasons to use R for the task; I personally would use QGIS or other processing software such as FME.

QGIS is a powerful opensource software (which you can download from here for free) packed with great geoprocessing tools you might have to combine to check out the the difference between the 2 Shapefiles. More details about these tools are available from this link (click me) . I would experiment with:

  1. Clip
  2. Difference
  3. Intersection
  4. Symmetrical Difference

enter image description here

As for FME; it is a commercial software but you can still download and use a fully functional license. They have a "transformer" (tool) called ChangeDetector that does exactly what you are looking for.

enter image description here

You just need to set the original Shapefile and the New Shapefile. You can base your request on Geometry or Fields.

enter image description here

  • Hey @MyGIS! Thanks for your comment. I am actually using R because this is for a course I'm taking in Spatial Statistics, and I am already familiar with QGIS. Any advice on how to move forward doing this with R? – Drew Heiderscheidt Nov 26 '19 at 1:41
  • @DrewHeiderscheidt, if I had to do this blindly without seeing the data, I would calculate the area of each polygon then join the tables based on the districts names then subtract one area column from the other (assuming that the tables have been joined) and the ones with a result different from zero "0" would be the one that has changed. After a quick search, I have found that there are some Spatial tools such as "spatial.tools" from rdrr.io/rforge/spatial.tools or RSpatial: rspatial.org but I wouldn't be able to comment much on them as I have never used them. Lyes. – MyGIS Nov 26 '19 at 2:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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