mosstool.trip.generator.gravity

Module Contents

Classes

GravityGenerator

Generate OD matrix inside the given area, based on the gravity model.

Data

API

mosstool.trip.generator.gravity.__all__

[‘GravityGenerator’]

class mosstool.trip.generator.gravity.GravityGenerator(Lambda: float, Alpha: float, Beta: float, Gamma: float)

Generate OD matrix inside the given area, based on the gravity model.

Initialization

Args:

  • pops (list[int]): The population of each area.

  • dists (np.ndarray): The distance matrix between each pair of areas.

load_area(area: geopandas.GeoDataFrame)

Load the area data.

Args:

  • area (gpd.GeoDataFrame): The area data. Must contain a ‘geometry’ column with geometric information and a defined crs string.

_get_one_point()

get one point from the shapefile

_calculate_utm_epsg(longitude: float, latitude: float)

Calculate the UTM zone and corresponding EPSG code for a given longitude and latitude.

Args: longitude (float): The longitude of the location. latitude (float): The latitude of the location.

Returns: int: The EPSG code for the UTM zone.

cal_distance()

Euclidean distance matrix get the distance matrix for regions in the area based on the shapefile of the area

generate(pops)

Generate the OD matrix based on the gravity model.

Args:

  • pops (list[int]): The population of each area.

  • dists (np.ndarray): The distance matrix between each pair of areas.

Returns:

  • np.ndarray: The generated OD matrix.