Skip to content

astrosat/cOSMos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cOSMos package for OSM data retrieval

cOSMos is a thin wrapper for OSM overpass API that provides a number of helper functions to make downloading particular Open Street Map data easier. It allows to extract common features of interest (road networks, city locations, building footprints) based on location name.

Install

pip install cosmos-osm

Using from shell

Location defined on instantiation.

from cosmos import Data

data = Data('Krakow')

roads = data.get('roads', format='geojson')

Location passed as argument.

from cosmos import Data

data = Data()

cities = data.get('cities', 'Scotland', format='geojson')
roads = data.get('roads', 'Kuala Lumpur', format='geojson')

Location defined by bbox.

south = 47.3202203,
west = 8.4480061
north = 47.4346662
east = 8.6254413
zurich = (south, west, north, east)

# Without format argument it will return 2 generators with geometries and tags.
buildings, tags = data.get('buildings', bbox=zurich)

Using from command line

From terminal:

cosmos --location=Musselburgh --filename=musselburgh_roads.geojson

Will create musselburgh_roads.geojson GeoJSON file with road network for Musselburgh. Here's --help output:

Usage: cosmos [OPTIONS]

Options:
  --location TEXT                 input location name(city, country)
  --filename TEXT                 output file name
  --dtype [roads|cities|buildings]
                                  data type
  --bbox <FLOAT FLOAT FLOAT FLOAT>...
                                  bbox in form (south, west, north, east)
  --help                          Show this message and exit.

Data types

Currently implemented data types than can be extracted with cOSMos

Name Geometry Example
Roads LineString data.get('roads', 'London')
Cities Point data.get('cities', 'Portugal')
Buildings Polygon data.get('buildings', 'Prague')

Dependencies

cOSMos uses a number of awesome python packages, please check their websites:

Releases

No releases published

Packages

No packages published

Languages