voyagerpy.spatial.to_points#

voyagerpy.spatial.to_points(x: str | Series | ndarray, y: str | Series | ndarray, data: GeoDataFrame | DataFrame | None = None, scale: float = 1, radius: float | None = None) GeoSeries#

Create a GeoSeries from x and y coordinates. If radius is not None, will create a circle with the given radius around each point. Otherwise, will create a point at each x,y coordinate.

Parameters:
  • x (Union[str, pd.Series, np.ndarray]) – The x coordinates of the points. If str, will use data[x].

  • y (Union[str, pd.Series, np.ndarray]) – The y coordinates of the points. If str, will use data[y].

  • data (Union[gpd.GeoDataFrame, pd.DataFrame, None], optional) – The dataframe to get x and y from if the are str, by default None

  • scale (float, optional) – The scale to use for converting the coordinates to pixel coordinates, by default 1

  • radius (Optional[float], optional) – If supplied, the radius of the circle at each coordinate, by default None

Returns:

Geoseries of points at the given coordinates. If radius is not None, each coordinate will be a circle of type Polycon with the given radius.

Return type:

gpd.GeoSeries

Raises:

ValueError – If data is None, and x or y is str.