Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/astrosat/cosmos
cOSMos package for OSM data retrieval
https://github.com/astrosat/cosmos
gis openstreetmap openstreetmap-data osm overpass-api remote-sensing
Last synced: about 1 month ago
JSON representation
cOSMos package for OSM data retrieval
- Host: GitHub
- URL: https://github.com/astrosat/cosmos
- Owner: astrosat
- License: mit
- Created: 2017-02-20T11:34:36.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-02-08T10:35:16.000Z (almost 7 years ago)
- Last Synced: 2024-10-11T20:42:25.554Z (2 months ago)
- Topics: gis, openstreetmap, openstreetmap-data, osm, overpass-api, remote-sensing
- Language: Python
- Size: 667 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cOSMos package for OSM data retrieval
**cOSMos** is a thin wrapper for [OSM overpass API](http://wiki.openstreetmap.org/wiki/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
```bash
pip install cosmos-osm
```# Using from shell
Location defined on instantiation.
```python
from cosmos import Datadata = Data('Krakow')
roads = data.get('roads', format='geojson')
```Location passed as argument.
```python
from cosmos import Datadata = Data()
cities = data.get('cities', 'Scotland', format='geojson')
roads = data.get('roads', 'Kuala Lumpur', format='geojson')
```Location defined by bbox.
```python
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:
```bash
cosmos --location=Musselburgh --filename=musselburgh_roads.geojson
```
Will create musselburgh_roads.geojson GeoJSON file with road network for Musselburgh. Here's `--help` output:
```bash
Usage: cosmos [OPTIONS]Options:
--location TEXT input location name(city, country)
--filename TEXT output file name
--dtype [roads|cities|buildings]
data type
--bbox ...
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:* [geopy](https://github.com/geopy/geopy)
* [python-geojson](https://github.com/frewsxcv/python-geojson)
* [click](http://click.pocoo.org/5/)
* [requests](http://docs.python-requests.org/en/master/)
* [shapely](http://toblerity.org/shapely/)