gemgis.utils.get_locations
gemgis.utils.get_locations#
- gemgis.utils.get_locations(names: Union[list, str], crs: Union[str, pyproj.crs.crs.CRS] = 'EPSG:4326') dict #
Obtaining coordinates for one city or a list of given cities. A CRS other than ‘EPSG:4326’ can be passed to transform the coordinates
- Parameters
names (Union[list, str]) – List of cities or single city name, e.g.
names=['Aachen', 'Cologne', 'Munich', 'Berlin']
crs (Union[str, pyproj.crs.crs.CRS]) – CRS that coordinates will be transformed to, e.g.
crs='EPSG:4647'
, default is the GeoPy crs'EPSG:4326'
- Returns
location_dict – Dict containing the addresses and coordinates of the selected cities
- Return type
dict
New in version 1.0.x.
Example
>>> # Loading Libraries and get location objects >>> import gemgis as gg >>> names = ['Aachen', 'Cologne', 'Munich', 'Berlin'] >>> location_dict = gg.utils.get_locations(names=names, crs='EPSG:4647') >>> location_dict {'Aachen, Städteregion Aachen, Nordrhein-Westfalen, Deutschland': (32294411.33488576, 5629009.357074926), 'Köln, Nordrhein-Westfalen, Deutschland': (32356668.818424627, 5644952.099932303), 'München, Bayern, Deutschland': (32691595.356409974, 5334747.274305081), 'Berlin, 10117, Deutschland': (32797738.56053437, 5827603.740024588)}
See also
transform_location_coordinate
Transforming location coordinate to another CRS
get_location_coordinate
Get GeoPy Location Object
create_polygon_from_location
Create Shapely Polygon from GeoPy Location Object bounds