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

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在ArrayList中比较数字   java在Kotlin中使异步调用同步   让“Scala编程”junit示例在IntelliJ中工作的java问题   java Servlet侦听器未在ContextListener中设置属性   将Microsoft SQL Server数据库连接到我的Java项目   加载资源时出现java“需要注册工厂”异常   java如何使用POI检查excel中的重复记录?   java如何更改机器生成的代码   java如何确保重写的方法是同步的   用Spring编写Hibernate时的java XML奥秘   java管理mysql数据库中存储的用户权限   java如何运行。来自Javascript的jar方法   java我想在Web应用程序中进行身份验证&对桌面应用程序使用相同的凭据。我该怎么做?