module documentation
Utility functions for geo-coordinates and geoJSON
| Function | geo |
Check if a shape contains another shape. |
| Function | geo |
Check if a shape intersects another shape. |
| Function | geo |
Check if a shape is within another shape. |
| Function | get |
Get the geo-point from a geoJSON object. |
| Function | get |
Get the geo-polygon from a geoJSON object. |
| Function | get |
Get a shapely geometry object from a geoJSON shape. |
| Function | is |
Check if a location is inside a polygon. |
def geoContains(aType:
GeometryType, aShape: tuple | list, bType: GeometryType, bShape: tuple | list) -> bool:
¶
Check if a shape contains another shape.
| Parameters | |
aGeometryType | The type of the first shape. |
atuple | list | The shape of the first shape. |
bGeometryType | The type of the second shape. |
btuple | list | The shape of the second shape. |
| Returns | |
bool | True if the first shape (fully) contains the second shape, False otherwise. |
def geoIntersects(aType:
GeometryType, aShape: tuple | list, bType: GeometryType, bShape: tuple | list) -> bool:
¶
Check if a shape intersects another shape.
| Parameters | |
aGeometryType | The type of the first shape. |
atuple | list | The shape of the first shape. |
bGeometryType | The type of the second shape. |
btuple | list | The shape of the second shape. |
| Returns | |
bool | True if the first shape intersects the second shape, False otherwise. |
def geoWithin(aType:
GeometryType, aShape: tuple | list, bType: GeometryType, bShape: tuple | list) -> bool:
¶
Check if a shape is within another shape.
| Parameters | |
aGeometryType | The type of the first shape. |
atuple | list | The shape of the first shape. |
bGeometryType | The type of the second shape. |
btuple | list | The shape of the second shape. |
| Returns | |
bool | True if the first shape is (fully) within the second shape, False otherwise. |
Get the geo-point from a geoJSON object.
| Parameters | |
jsn:dict | str | None | The geoJSON object as a dictionary or a string. |
| Returns | |
tuple[ | A tuple of the geo-point (latitude, longitude). None if not found or invalid JSON. |
Get the geo-polygon from a geoJSON object.
| Parameters | |
jsn:dict | str | None | The geoJSON object as a dictionary or a string. |
| Returns | |
list[ | A list of tuples of the geo-polygon (latitude, longitude). None if not found or invalid JSON. |
Get a shapely geometry object from a geoJSON shape.
| Parameters | |
typ:GeometryType | The geometry type. |
shape:tuple | list | The geoJSON shape as a tuple or list. |
| Returns | |
BaseGeometry | A shapely geometry object. |
def isLocationInsidePolygon(polygon:
list[ tuple[ float, float]], location: tuple[ float, float]) -> bool:
¶
Check if a location is inside a polygon.
| Parameters | |
polygon:list[ | The polygon as a list of tuples (latitude, longitude). |
location:tuple[ | The location as a tuple (latitude, longitude). |
| Returns | |
bool | True if the location is inside the polygon, False otherwise. |