transbigdata.odagg_shape

transbigdata.odagg_shape(oddata, shape, col=['slon', 'slat', 'elon', 'elat'], params=None, round_accuracy=6, arrow=False, **kwargs)

Generate the OD aggregation results and the corresponding geometry. The input is the OD data (each row represents a trip). The OD will assigned to grids and then aggregated in the form of GeoDataFrame.

Parameters:
  • oddata (DataFrame) – OD data

  • shape (GeoDataFrame) – GeoDataFrame of the target traffic zone

  • col (List) – The column of the origin/destination location,[‘slon’,’slat’,’elon’ ,’elat’]. The default weight is 1 for each column. You can also add the weight parameter, for example, [‘slon’,’slat’,’elon’,’elat’, ’count’].

  • params (List (optional)) – Gridding parameters (lonStart,latStart,deltaLon,deltaLat), lonStart and latStart are the lower-left coordinates, deltaLon, deltaLat are the length and width of a single grid If availabel, After the data gridding, the traffic zone will be matched based on the grid center. If not available, then the matching will be processed based on longitude and latitude. When the number of data items is large, the matching efficiency will be improved greatly thanks to data gridding.

  • round_accuracy (number) – The number of decimal for latitude and longitude when implementing aggregation

  • arrow (bool) – Whether the generated OD geographic line contains arrows

Returns:

oddata1 – GeoDataFrame of OD after aggregation

Return type:

GeoDataFrame