Code Monkey home page Code Monkey logo

geo_sampling's Introduction

Geo sampling

https://ci.appveyor.com/api/projects/status/gtm9ao3u7ir4gs0w?svg=true https://travis-ci.org/soodoku/geo_sampling.svg?branch=public https://img.shields.io/pypi/v/geo_sampling.svg?maxAge=2592000 Documentation Status

Say you want to learn about the average number of potholes per kilometer of street in a city. Or estimate a similar such quantity. To estimate the quantity, you need to sample locations on the streets. This package helps you sample those locations. In particular, the package implements the following sampling strategy:

  1. Sampling Frame: Get all the streets in the region of interest from OpenStreetMap. To accomplish that, the package first downloads administrative boundary data for the country in which the region is located in ESRI format from http://www.gadm.org/country The administrative data is in multiple levels, for instance, cities are nested in states, which are nested in countries. The user can choose a city or state, but not a portion of a city. And then the package uses the pyshp package to build a URL for the site http://extract.bbbike.org from which we can download the OSM data.

  2. Sampling Design:

    • For each street (or road), starting from one end of the street, we split the street into .5 km segments till we reach the end of the street. (The last segment, or if the street is shorter than .5km, the only segment, can be shorter than .5 km.)
    • Get the lat/long of starting and ending points of each of the segments. And assume that the street is a straight line between the .5 km segment.
    • Next, create a database of all the segments
    • Sample rows from the database and produce a CSV of the sampled segments
    • Plot the lat/long --- filling all the area within the segment. These shaded regions are regions for which data needs to be collected.
  3. Data Collection: Collect data on the highlighted segments.

Prerequisites

There are a couple dependencies that need to be built from source on Windows so you may need to install Microsoft Visual C++ Compiler for Python 2.7.

Installation

Prepare the working directory. We recommend that you install in the Python virtual environment.

mkdir geo_sampling
cd geo_sampling
virtualenv -p python2.7 venv
. venv/bin/activate

Upgrade Python packages pip and setuptools to the latest version.

pip install --upgrade pip setuptools

Install geo-sampling package from PyPI.

pip install geo-sampling

Documentation

For more information please visit the project documentation page.

Authors

Suriyan Laohaprapanon and Gaurav Sood

License

Scripts are released under the MIT License.

geo_sampling's People

Contributors

soodoku avatar suriyan avatar

Watchers

 avatar  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.