Scripts for sampling Geo data sets by the specific region name
Project description
Geo sampling
Say you want to learn about the average number of potholes per kilometer of street in a city. Or estimate a similar quantity. The package allows you to sample locations randomly to allow for collecting such data. In particular, the package facilitates the following workflow:
Get all the streets in a specific region from OpenStreetMap data.
Starting from one end of the street, split each street into .5 km segments till you 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 point and ending point of each of the segments. Assume that the street is a straight line between the .5 km segment.
Create a database of all the segments
segment_id, street_name, start_lat, start_long, end_lat, end_long
Sample rows from the database
Produce a CSV of the sampled segments
Plot the lat/long — filling all the area within the segment.
Collect data on the highlighted segments.
Prerequisites
There are a couple dependencies that need to be built from the 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 test PyPI.
pip install --extra-index-url https://testpypi.python.org/pypi geo-sampling
For more information please visit the project documentation page.
License
Scripts are released under the MIT License.