edisgo.tools.geo
¶
Module Contents¶
Functions¶
|
Transforms to equidistant projection (epsg:3035). |
|
Transforms back from equidistant projection to given projection. |
|
Transforms from specified projection to other specified projection. |
|
Determines lines that are at least partly within buffer around given bus. |
|
Calculates the geodesic distance between two buses in km. |
|
Finds the nearest bus in bus_target to a given point. |
|
Searches all lines for the nearest possible connection object per line. |
|
- edisgo.tools.geo.proj2equidistant(srid)[source]¶
Transforms to equidistant projection (epsg:3035).
- Parameters
srid (int) – Spatial reference identifier of geometry to transform.
- Return type
- edisgo.tools.geo.proj2equidistant_reverse(srid)[source]¶
Transforms back from equidistant projection to given projection.
- Parameters
srid (int) – Spatial reference identifier of geometry to transform.
- Return type
- edisgo.tools.geo.proj_by_srids(srid1, srid2)[source]¶
Transforms from specified projection to other specified projection.
- Parameters
- Return type
Notes
Projections often used are conformal projection (epsg:4326), equidistant projection (epsg:3035) and spherical mercator projection (epsg:3857).
- edisgo.tools.geo.calc_geo_lines_in_buffer(grid_topology, bus, grid, buffer_radius=2000, buffer_radius_inc=1000)[source]¶
Determines lines that are at least partly within buffer around given bus.
If there are no lines, the buffer specified in buffer_radius is successively extended by buffer_radius_inc until lines are found.
- Parameters
grid_topology (
Topology
) –bus (pandas.Series) – Data of origin bus the buffer is created around. Series has same rows as columns of
buses_df
.grid (
Grid
) – Grid whose lines are searched.buffer_radius (float, optional) – Radius in m used to find connection targets. Default: 2000.
buffer_radius_inc (float, optional) – Radius in m which is incrementally added to buffer_radius as long as no target is found. Default: 1000.
- Returns
List of lines in buffer (meaning close to the bus) sorted by the lines’ representatives.
- Return type
- edisgo.tools.geo.calc_geo_dist_vincenty(grid_topology, bus_source, bus_target, branch_detour_factor=1.3)[source]¶
Calculates the geodesic distance between two buses in km.
The detour factor in config_grid is incorporated in the geodesic distance.
- Parameters
- Returns
Distance in km.
- Return type
- edisgo.tools.geo.find_nearest_bus(point, bus_target)[source]¶
Finds the nearest bus in bus_target to a given point.
- Parameters
point (shapely.Point) – Point to find the nearest bus for.
bus_target (pandas.DataFrame) – Dataframe with candidate buses and their positions given in ‘x’ and ‘y’ columns. The dataframe has the same format as
buses_df
.
- Returns
Tuple that contains the name of the nearest bus and its distance in km.
- Return type
- edisgo.tools.geo.find_nearest_conn_objects(grid_topology, bus, lines, conn_diff_tolerance=0.0001)[source]¶
Searches all lines for the nearest possible connection object per line.
It picks out 1 object out of 3 possible objects: 2 line-adjacent buses and 1 potentially created branch tee on the line (using perpendicular projection). The resulting stack (list) is sorted ascending by distance from bus.
- Parameters
grid_topology (
Topology
) –bus (pandas.Series) – Data of bus to connect. Series has same rows as columns of
buses_df
.lines (list(str)) – List of line representatives from index of
lines_df
.conn_diff_tolerance (float, optional) – Threshold which is used to determine if 2 objects are at the same position. Default: 0.0001.
- Returns
List of connection objects. Each object is represented by dict with representative, shapely object and distance to node.
- Return type
- edisgo.tools.geo.mv_grid_gdf(edisgo_obj: edisgo.EDisGo)[source]¶