gemgis.utils.create_polygon_from_location
gemgis.utils.create_polygon_from_location#
- gemgis.utils.create_polygon_from_location(coordinates) shapely.geometry.polygon.Polygon #
Creating Shapely Polygon from bounding box coordinates
- Parameters
coordinates (geopy.location.Location) – GeoPy location object
- Returns
polygon – Shapely Polygon marking the bounding box of the coordinate object
- Return type
shapely.geometry.polygon.Polygon
New in version 1.0.x.
Example
>>> # Loading Libraries and get location object >>> import gemgis as gg >>> location = gg.utils.get_location_coordinate(name='Aachen') >>> location Location(Aachen, Städteregion Aachen, Nordrhein-Westfalen, Deutschland, (50.776351, 6.083862, 0.0))
>>> # Creating polygon from location bounds >>> polygon = gg.utils.create_polygon_from_location(coordinates=location) >>> polygon.wkt 'POLYGON ((50.8572449 5.9748624, 50.8572449 6.2180747, 50.6621373 6.2180747, 50.6621373 5.9748624, 50.8572449 5.9748624))'
See also
transform_location_coordinate
Transforming location coordinate to another CRS
get_location_coordinate
Get GeoPy Location Object
get_locations
Get location information for a list of city names