Code Monkey home page Code Monkey logo

cosmos's Introduction

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:

cosmos's People

Contributors

ajgeers avatar bheliom avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.