unicef / magicbox

A platform that uses real-time data to inform life-saving humanitarian responses to emergency situations
https://www.unicef.org/innovation/Magicbox
BSD 3-Clause "New" or "Revised" License
86 stars 16 forks source link

Aggregate polygons of one shapefile by another #44

Open mikefab opened 6 years ago

mikefab commented 6 years ago

Problem description

When working with region-based datasets, we usually encounter the situation where the polygons in one dataset do not geospatially align with the polygons in another.

Examples:

One feature we want for the MagicBox Platform is the ability to aggregate the values for polygons of one shapefile/GeoJSON/csv based on the polygons of another shapefile/GeoJSON/csv. Hence, corresponding with the examples above:

The pattern is spotted:

An example use case

Here you see a Voronoi diagram over a country shapefile. The generating points are arbitrary, but we can assume they are cell tower locations (pairs of coordinates to be exact). screen shot 2018-10-03 at 2 16 44 pm

This Medium article discusses in-depth this use case, though it goes one step further with the output. Going beyond (origin_admin, destination_admin, mobility_value) for each row/tuple in the resulting geofile, it asks for a mobility matrix. The latter is easily generated from the former, though.