按特定区域名称采样地理数据集的脚本

geo-sampling的Python项目详细描述


地理采样

https://ci.appveyor.com/api/projects/status/2d42agdbafj0i3s7?svg=truehttps://travis-ci.org/geosensing/geo_sampling.svg?branch=publichttps://img.shields.io/pypi/v/geo_sampling.svg?maxAge=3600Documentation Status

假设你想了解一个城市每公里街道的平均坑洞数。或者估计类似的数量。要估计数量,需要对街道上的位置进行采样。这个软件包可以帮助您对这些位置进行采样。特别是,该软件包实现了以下采样策略:

  1. sampling frame:从OpenStreetMap获取感兴趣区域的所有街道。为此,该软件包首先以esri格式从http://www.gadm.org/country下载该地区所在国家的行政边界数据。行政数据分为多个级别,例如,城市嵌套在国家中的州中。用户可以选择城市或州,但不能选择城市的一部分。然后这个包使用pyshp package为站点http://extract.bbbike.org构建一个url,我们可以从中下载osm数据。

  2. 抽样设计

    • 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. 数据收集:在突出显示的段上收集数据。

先决条件

有几个依赖项需要从windows上的源代码构建,因此您可能需要安装Microsoft Visual C++ Compiler for Python 2.7

安装

准备工作目录。我们建议您安装在python虚拟环境中。

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

将python包pipsetuptools升级到最新版本。

pip install --upgrade pip setuptools

从pypi安装地理采样包。

pip install geo-sampling

下载

截至2018年2月4日,该软件包已被下载3000多次(见saved BigQuery)。

作者

苏里扬·劳哈普拉帕农和高拉夫·苏德

许可证

脚本在MIT License下发布。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
反射Java getMethod()会导致NoSuchMethodException错误   编译器构造Java编译时错误:解析时到达文件末尾   java我无法使用Spring Boot从应用程序引擎中的服务连接到Google数据存储   java单一注销配置文件Idp注销问题   regex如何在java中编写和使用正则表达式   java Android:单击标签打开电子邮件应用程序   java如何确保函数执行函数的整个检查?   java如何将字母数字电话号码转换为数字   listview更改中项目内部的java ImageView   java将空对象转换为整数   对等端重置java Google Drive SDk连接   在java程序中测试未授权的隐藏测试(代码战)