Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/geosensing/geo_sampling
Randomly sample locations on streets
https://github.com/geosensing/geo_sampling
osm
Last synced: 11 days ago
JSON representation
Randomly sample locations on streets
- Host: GitHub
- URL: https://github.com/geosensing/geo_sampling
- Owner: geosensing
- License: mit
- Created: 2016-10-16T17:40:46.000Z (about 8 years ago)
- Default Branch: public
- Last Pushed: 2024-07-15T17:29:11.000Z (4 months ago)
- Last Synced: 2024-10-11T12:09:24.852Z (about 1 month ago)
- Topics: osm
- Language: Python
- Homepage: http://geo-sampling.readthedocs.io/
- Size: 3.26 MB
- Stars: 5
- Watchers: 3
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
- Citation: Citation.cff
Awesome Lists containing this project
README
Geo sampling: Randomly sample locations on streets
===================================================.. image:: https://img.shields.io/pypi/v/geo_sampling.svg?maxAge=3600
:target: https://pypi.python.org/pypi/geo_sampling
.. image:: https://readthedocs.org/projects/geo-sampling/badge/?version=latest
:target: http://geo-sampling.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status
.. image:: https://pepy.tech/badge/geo-sampling
:target: https://pepy.tech/project/geo-samplingSay 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/activateUpgrade 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
==============* `More information on installation `_
* `Usage `_
* `Sample workflow `_For more information please visit the `project documentation page `_.
Downloads
==========
As of February 4th, 2018, the package had been downloaded nearly 5,000 times (see the `saved BigQuery `__).Authors
=======Suriyan Laohaprapanon and Gaurav Sood
License
=======Scripts are released under the `MIT License `__.