sids_from_shapely#
- sids_from_shapely(geom, level, convex=False, force_ccw=False)#
Wrapper for starepandas.from_point(), starepandas.from_ring(), starepandas.from_polygon(), starepandas.from_multipolygon()
Takes a shapely Point, Polygon, or Multipolygon and looks up the STARE representation
- Parameters:
- geom: shapely.geometry.Point, shapely.geometry.Polygon, shapely.geometry.MultiPolygon
A shapely geometry to look the sids up for
- level: int
Maximum STARE level to use for lookup
- convex: bool
Toggle if the STARE lookup should be performed on the convex hull rather than the actual geometry of the polygon.
- force_ccw: bool
Toggle if counter-clockwise should be forced. Counter clockwise meaning that the “inside” of a ring will always be left of its vertices and edges.
- Returns:
- sids:
collection of sids
Examples
>>> import shapely >>> import starepandas
Point:
>>> point = shapely.geometry.Point(10.5, 20) >>> starepandas.sids_from_shapely(point, level=27) 4598246232954051067
Polygon:
>>> polygon1 = shapely.geometry.Polygon([(0, 0), (1, 1), (1, 0)]) >>> starepandas.sids_from_shapely(polygon1, force_ccw=True, level=6) array([4430697608402436102, 4430838345890791430, 4430979083379146758])
Multipolygon:
>>> polygon2 = shapely.geometry.Polygon([(5, 5), (6, 6), (6, 5)]) >>> multipolygon = shapely.geometry.MultiPolygon([polygon1, polygon2]) >>> starepandas.sids_from_shapely(multipolygon, force_ccw=True, level=5) array([4430416133425725445, 4430979083379146757, 4416905334543613957])