OVERPROPF.C

Overpropf overlays two maps (aka planar graphs), and computes the areas of all the nonempty intersections of any polygon of one map with any polygon of the other.

One application is to interpolate some statistic of one map over to the other.  E.g., we might have the population of each polygon of one map, and wish to estimate the polygon of each polygon of the other map from the fractions of intersected areas.

It is very fast because it uses my uniform grid and my local topological formulae. 

I mostly wrote this around 1990, and only lightly modernized it later.

Venkateshkumar Sivaswami did some of the work as part of his masters.  Salles Viana Gomes de Magalhães recently provided test data.

Links to papers are here:  https://wrf.ecse.rpi.edu/nikola/pages/overlay/

The input map format is Harvard Odyssey, described in db/Notes .

Test case: Intersecting salles/brc (Brazil counties) and salles/brs (Brazil soil) with a 1000x1000 grid, run thus:

doitf salles/usa salles/usc 1000  (doitf is defined in fns)

The machine is a 4-year-old Lenovo w540 laptop.

Output:

= Map #0? Number of chains= 16545
Greatest number of points per chain= 580
= Map #1? Number of chains= 7950
Greatest number of points per chain= 753
Map 0: Average edge length component as fraction of map size= 0.000194
Map 1: Average edge length component as fraction of map size= 0.000291
= Map #0: 342738 vertices, 323021 edges, 5566 polygons
= Map #1: 258961 vertices, 250801 edges, 2958 polygons
= Histogram of number of cells with n edges, for 0<=n<=56:
 770742 60317 44555 30967 21814 16657 12706 9993 7643 6144 4662 3423 2678 2065 1455 1076 857 611 445 304 233 164 109 95 79 61 38 19 23 14 7 8 7 8 6 3 3 3 1 0 1 0 1 1 0 0 0 0 1 0 0 0 0 0 0 0 1
Number of pairs of edges tested for intersection= 605995
Number of intersections found= 20932
Number of output polygons: 19774

= Execution times:
   Read map:                      0.47
   Scale vertices:                0.00
   Extract edges:                 0.02
   Calculate areas:               0.03
   Make grid:                     0.02
   Add map to grid:               0.05
   Intersect edges:               0.05
   Locate map 0 points in map 1:  0.07
   Locate map 1 points in map 0:  0.07
   Accumulate areas:              0.07
   Print areas:                   0.03

TOTAL TIME=                       0.87

That is, apart from i/o, 0.37 seconds, to find the areas of all the polygon intersections of one map with 2958 polygons and 258961 vertices against another map with 5566 polygons and 342738 vertices.


--

This program does not use parallelism, although that could be easily added.

Limitations:
- Overpropf requires that the input maps be topologically correct, or the output is meaningless.
- Overpropf scales down the map coordinates to save space.  This might cause errors.
- I wrote this almost 30 years ago.   Today, I write better code.

Later programs:
- Do the computations with rational numbers, in parallel, to avoid roundoff.
- Actually intersect the maps, in 2d and 3d.

--
W. Randolph Franklin, Professor
ECSE Dept., 6026 JEC,
Rensselaer Polytechnic Inst,
110 8th St,
Troy NY, 12180 USA

mail@wrfranklin.org or frankwr@rpi.edu 
+1 (518) 276-6077 

https://wrf.ecse.rpi.edu/


