neptyne.geo

@geo_call(convert_to_meters=True)
def area( target: neptyne_kernel.cell_range.CellRange | shapely.geometry.base.BaseGeometry) -> float | list[float]:

Returns the area in square meters of the given target.

target: shape or cell range containing shapes

@geo_call(convert_to_meters=False)
def boundary( target: shapely.geometry.base.BaseGeometry) -> shapely.geometry.base.BaseGeometry:

Returns a lower dimension geometry that bounds the object

The boundary of a polygon is a line, the boundary of a line is a collection of points. The boundary of a point is an empty (null) collection.

@with_geodata_frames
def buffer( target: shapely.geometry.base.BaseGeometry, distance: float, quad_segs=16, cap_style='round', join_style='round', mitre_limit=5.0, single_sided=False) -> shapely.geometry.base.BaseGeometry:

Returns a geometry that represents all points whose distance from this geometry is less than or equal to distance.

cap_style : shapely.BufferCapStyle or {'round', 'square', 'flat'} join_style : shapely.BufferJoinStyle or {'round', 'mitre', 'bevel'}

@geo_call(convert_to_meters=False)
def centroid( target: shapely.geometry.base.BaseGeometry) -> shapely.geometry.point.Point:

Returns the geometric center of the object

The centroid is equal to the centroid of the set of component Geometries of highest dimension (since the lower-dimension geometries contribute zero "weight" to the centroid).

def dataset(name_or_url: str) -> geopandas.geodataframe.GeoDataFrame:

Returns a sample dataset given a name or url.

Named datasets are taken from geopandas.datasets, geoplot.datasets and geodatasets.

Example: =geo.dataset("naturalearth_lowres") -- returns a GeoDataFrame with countries

@geo_call(convert_to_meters=False)
def difference( element1: shapely.geometry.base.BaseGeometry, element2: shapely.geometry.base.BaseGeometry) -> shapely.geometry.base.BaseGeometry:

Returns the part of element1 that is not covered by element2.

@geo_call(convert_to_meters=True)
def distance( target: shapely.geometry.base.BaseGeometry, other: shapely.geometry.base.BaseGeometry) -> float:

Returns the distance in meters between two shapes or cell ranges.

Example: =geo.distance(A1, geo.geocode("Amsterdam")) - returns the distance between A1 and Amsterdam in meters

@with_geodata_frames
def explore(target: neptyne_kernel.cell_range.CellRange, *args, **kwargs):

Show a map of the given target(s).

def geocode( query: str | list[str]) -> shapely.geometry.point.Point | geopandas.geodataframe.GeoDataFrame:

Returns the coordinates of the given query.

Example: =geo.geocode("Amsterdam") -- returns a Point with the coordinates of Amsterdam

@geo_call(convert_to_meters=True)
def hausdorff_distance( target: shapely.geometry.base.BaseGeometry, other: shapely.geometry.base.BaseGeometry) -> float:

The Hausdorff distance is the maximum distance from a point in target to the nearest point in other

It's a way to quantify the dissimilarity between two geometric shapes. This measurement can be especially useful in spatial analysis and computational geometry tasks.

@geo_call(convert_to_meters=False)
def intersection( element1: shapely.geometry.base.BaseGeometry, element2: shapely.geometry.base.BaseGeometry) -> shapely.geometry.base.BaseGeometry:

Returns the part of element1 that is covered by element2.

@with_geodata_frames
def lat(target: shapely.geometry.base.BaseGeometry) -> float:

Returns the latitude of the given target.

@with_geodata_frames
def lng(target: shapely.geometry.base.BaseGeometry) -> float:

Returns the longitude of the given target.

@geo_call(convert_to_meters=True)
def length(target: shapely.geometry.base.BaseGeometry) -> float:

Returns the length in meters of the given target

@with_geodata_frames
def plot(gdf: geopandas.geodataframe.GeoDataFrame, *args, **kwargs):
def reverse_geocode(points, provider=None, **kwargs):

Reverse geocode a set of points and get a GeoDataFrame of the resulting addresses.

The points

Parameters

points : list or Series of Shapely Point objects. x coordinate is longitude y coordinate is latitude provider : str or geopy.geocoder (opt) Specifies geocoding service to use. If none is provided, will use 'photon' (see the Photon's terms of service at: https://photon.komoot.io).

Either the string name used by geopy (as specified in
geopy.geocoders.SERVICE_TO_GEOCODER) or a geopy Geocoder instance
(e.g., geopy.geocoders.Photon) may be used.

Some providers require additional arguments such as access keys
See each geocoder's specific parameters in geopy.geocoders

Notes

Ensure proper use of the results by consulting the Terms of Service for your provider.

Reverse geocoding requires geopy. Install it using 'pip install geopy'. See also https://github.com/geopy/geopy

Examples

>>> from shapely.geometry import Point
>>> df = geopandas.tools.reverse_geocode(  # doctest: +SKIP
...     [Point(-71.0594869, 42.3584697), Point(-77.0365305, 38.8977332)]
... )
>>> df  # doctest: +SKIP
                     geometry                                            address
0  POINT (-71.05941 42.35837)       29 Court Sq, Boston, MA 02108, United States
1  POINT (-77.03641 38.89766)  1600 Pennsylvania Ave NW, Washington, DC 20006...
@with_geodata_frames
def sjoin( element1: geopandas.geodataframe.GeoDataFrame, element2: geopandas.geodataframe.GeoDataFrame, *, how='inner', predicate='intersects', lsuffix='left', rsuffix='right') -> geopandas.geodataframe.GeoDataFrame:

Spatial join of two GeoDataFrames.

Returns a GeoDataFrame with a new column containing the index of the element in element2 that intersects with the element in element1.

how : string, default 'inner' The type of join:

 * 'left': use keys from left_df; retain only left_df geometry column
 * 'right': use keys from right_df; retain only right_df geometry column
 * 'inner': use intersection of keys from both dfs; retain only
   left_df geometry column

predicate : string, default 'intersects' Binary predicate. Valid values are determined by the spatial index used. You can check the valid values in left_df or right_df as left_df.sindex.valid_query_predicates or right_df.sindex.valid_query_predicates lsuffix : string, default 'left' Suffix to apply to overlapping column names (left GeoDataFrame). rsuffix : string, default 'right' Suffix to apply to overlapping column names (right GeoDataFrame).

@geo_call(convert_to_meters=False)
def symmetric_difference( element1: shapely.geometry.base.BaseGeometry, element2: shapely.geometry.base.BaseGeometry) -> shapely.geometry.base.BaseGeometry:

Returns the parts of element1 and element2 that are not covered by the other

@geo_call(convert_to_meters=False)
def union( element1: shapely.geometry.base.BaseGeometry, element2: shapely.geometry.base.BaseGeometry) -> shapely.geometry.base.BaseGeometry:

Returns the union of element1 and element2

@with_geodata_frames
def wkt(target: shapely.geometry.base.BaseGeometry) -> str:

Returns the Well Known Text representation of the given target.