maup.intersections module

maup.intersections.intersections(sources, targets, output_type='geoseries', area_cutoff=None)[source]

Computes all of the nonempty intersections between two sets of geometries. By default, the returned ~geopandas.GeoSeries will have a MultiIndex, where the geometry at index (i, j) is the intersection of sources[i] and targets[j] (if it is not empty). If output_type == “geodataframe”, the return type is a range-indexed GeoDataFrame with “source” and “target” columns containing the indices i,j, respectively, for the intersection of sources[i] and targets[j] :param sources: geometries :type sources: GeoSeries or GeoDataFrame :param targets: geometries :type targets: GeoSeries or GeoDataFrame :rtype: GeoSeries :param area_cutoff: (optional) if provided, only return intersections with

area greater than area_cutoff

maup.intersections.prorate(relationship, data, weights, aggregate_by='sum')[source]

Prorate data from one set of geometries to another, using their ~maup.intersections or an assignment.

Parameters:
  • relationship – the intersections() of the geometries you are getting data from (sources) and the geometries you are moving the data to; or, a series assigning sources to targets

  • data (pandas.Series or pandas.DataFrame) – the data you want to move (must be indexed the same as the source geometries)

  • weights (pandas.Series) – the weights to use when prorating from sources to inters

  • aggregate_by (function) – (optional) the function to use for aggregating from inters to targets. The default is "sum".