iduedu.coordinate_node_ids

iduedu.coordinate_node_ids(points)[source]

Stable int64 node ids packed from the coordinates of points.

The longitude and latitude in EPSG:4326 are rounded to 1e-7 degree (the precision of OpenStreetMap), shifted to be non-negative and combined as (lat + 90°) * 3_600_000_001 + (lon + 180°) in units of 1e-7 degree, so divmod(node_id, 3_600_000_001) gives them back. The ids are below 2**63 and never negative.

Parameters:

points (GeoSeries | GeoDataFrame) – Points with a CRS, for example graph.nodes_gdf.

Return type:

ndarray

Returns:

Array of int64 ids in the order of points.

Raises:

ValueError – If the points have no CRS.