Skip to main content

Scripts for sampling Geo data sets by the specific region name

Project description

Geo sampling: Randomly sample locations on streets

https://img.shields.io/pypi/v/geo_sampling.svg?maxAge=3600 Documentation Status https://pepy.tech/badge/geo-sampling

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.

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

geo_sampling-0.1.2.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

geo_sampling-0.1.2-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file geo_sampling-0.1.2.tar.gz.

File metadata

  • Download URL: geo_sampling-0.1.2.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for geo_sampling-0.1.2.tar.gz
Algorithm Hash digest
SHA256 612ab5db3a8a241d14f39c79a1c56eef444a49b952898a4459f91e1b0a862776
MD5 05668b1905006a45dfc43e22a71125ea
BLAKE2b-256 9eca1105f70c0649286d3d8e8ffbe9caebbf28f2ba20a36cd84b01b7f066fbb5

See more details on using hashes here.

Provenance

The following attestation bundles were made for geo_sampling-0.1.2.tar.gz:

Publisher: python-publish.yml on geosensing/geo_sampling

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file geo_sampling-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: geo_sampling-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 12.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for geo_sampling-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c2163b8c8a3f24c01be7f771e0239fd2daa33d63cd7b6a0a004f88adc144458e
MD5 bc19590c89e707d467dda4882acdbb6f
BLAKE2b-256 c0eb2f501c5523d0b79e60d6699a949f799c95d368a0307f848428198d523e33

See more details on using hashes here.

Provenance

The following attestation bundles were made for geo_sampling-0.1.2-py3-none-any.whl:

Publisher: python-publish.yml on geosensing/geo_sampling

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page