用于编译地图数据的命令行实用程序。
mapturner的Python项目详细描述
#mapturner
一个命令行实用程序,用于从各种数据源生成整合的[topojson](https://github.com/mbostock/topojson/wiki/command-line-reference)。用于使用d3制作快速矢量地图。
重要链接:
*存储库:https://github.com/nprapps/mapturner
*问题:https://github.com/nprapps/mapturner/issues
install
已安装:
*ogr2ogr(gdal):`brew install ogr2ogr`
*topojson@1.6.27:(topojson 2+不工作)
`````
pip install mapturner
```
注意:由于"mapturner"依赖于topojson 1.x(旧版本的topojson),因此我们建议在项目根文件夹中安装此版本的topojson,方法是运行:
```
npm install-g topojson@1.6.27--前缀node_modules
````
r`将首先搜索项目中安装的topojson二进制文件,然后返回到$path上搜索topojson二进制文件。
````
git clone git://github.com/nprapps/mapturner.git
cd mapturner
mkvirtualenv mapturner
pip install-r requirements.txt
````
\usage
有效选项的完整列表详见本文档。
```
bbox:'77.25 24.28 91.45 31.5'
层:
国家:
类型:'shp'
路径:'http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10M/cultural/ne_10M_u admin_u 0_ries.zip'
id property:'name'
properties:
-'country=name'
cities:
type:'shp'
path:'http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10M/cultural/ne-10M\u-populated\u-simple.zip'
id-property:'name'
属性:
-'featurecla'
-'city=name'
其中:adm0name='nepal'和scalerank<;8
地震:
类型:'csv'
路径:'examples/nepal.csv'
所有属性:true
````
运行它!
```
mapturner input.yaml output.json
```
当前支持以下层类型:
*esri shapefile(`shp`)
*geojson或topojson(`json`)
*csv(`csv`)
*如果path是一个url,文件将被下载并在本地缓存。(在随后的运行中不会重新下载。)
*如果路径指向压缩文件,则将解压缩该文件。
*所有层都将剪裁到指定的边界框(使用ogr2ogr)。
*对于每个层,如果指定了"where"属性,则该子句将筛选层数据。
*f或者每一层,除非指定了"所有属性",否则将删除"属性"数组中未指定的层*中的所有字段(以减小文件大小),在这种情况下,将保留所有字段。
*对于每一层,如果设置了"id属性",则来自该属性的数据将被设置为他在图层中的功能。
*图层将被转换为[topojson](https://github.com/mbostock/topojson/wiki/command line reference)。
处理完每一层后,所有图层都将连接到一个topojson文件中。每个层的密钥名称将用于在输出中标识它。
有效类型是"shp"、"json"(geojson或topojson)和"csv"。**(必选)**
*`path`:图层数据文件的路径(相对或绝对)。**(必需)**
*`id property`:数据文件中用作功能唯一标识符的属性。另请参见[topojson命令行文档](https://github.com/mbostock/topojson/wiki/command line reference)。
*`properties`:要保留在输出中的数据的属性列表。将删除所有其他属性。
*`all properties`:如果为true,则保留此层的所有属性。
*`where`:将筛选功能数据的类似sql的查询谓词。这将使用与[ogr2ogr]完全相同的查询语法(http://www.gdal.org/ogr2ogr.html)。
*`纬度':包含点/要素纬度的数据中的列的名称。
*`经度':包含点/要素经度的数据中的列的名称。
缓存的形状文件存储在`~/.mapturner`中。您可能希望定期清除此文件夹以释放空间并确保重新下载更新的形状文件。
一个命令行实用程序,用于从各种数据源生成整合的[topojson](https://github.com/mbostock/topojson/wiki/command-line-reference)。用于使用d3制作快速矢量地图。
重要链接:
*存储库:https://github.com/nprapps/mapturner
*问题:https://github.com/nprapps/mapturner/issues
install
已安装:
*ogr2ogr(gdal):`brew install ogr2ogr`
*topojson@1.6.27:(topojson 2+不工作)
`````
pip install mapturner
```
注意:由于"mapturner"依赖于topojson 1.x(旧版本的topojson),因此我们建议在项目根文件夹中安装此版本的topojson,方法是运行:
```
npm install-g topojson@1.6.27--前缀node_modules
````
r`将首先搜索项目中安装的topojson二进制文件,然后返回到$path上搜索topojson二进制文件。
````
git clone git://github.com/nprapps/mapturner.git
cd mapturner
mkvirtualenv mapturner
pip install-r requirements.txt
\usage
有效选项的完整列表详见本文档。
```
bbox:'77.25 24.28 91.45 31.5'
层:
国家:
类型:'shp'
路径:'http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10M/cultural/ne_10M_u admin_u 0_ries.zip'
id property:'name'
properties:
-'country=name'
cities:
type:'shp'
path:'http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10M/cultural/ne-10M\u-populated\u-simple.zip'
id-property:'name'
属性:
-'featurecla'
-'city=name'
其中:adm0name='nepal'和scalerank<;8
地震:
类型:'csv'
路径:'examples/nepal.csv'
所有属性:true
````
运行它!
```
mapturner input.yaml output.json
```
当前支持以下层类型:
*esri shapefile(`shp`)
*geojson或topojson(`json`)
*csv(`csv`)
*如果path是一个url,文件将被下载并在本地缓存。(在随后的运行中不会重新下载。)
*如果路径指向压缩文件,则将解压缩该文件。
*所有层都将剪裁到指定的边界框(使用ogr2ogr)。
*对于每个层,如果指定了"where"属性,则该子句将筛选层数据。
*f或者每一层,除非指定了"所有属性",否则将删除"属性"数组中未指定的层*中的所有字段(以减小文件大小),在这种情况下,将保留所有字段。
*对于每一层,如果设置了"id属性",则来自该属性的数据将被设置为他在图层中的功能。
*图层将被转换为[topojson](https://github.com/mbostock/topojson/wiki/command line reference)。
处理完每一层后,所有图层都将连接到一个topojson文件中。每个层的密钥名称将用于在输出中标识它。
有效类型是"shp"、"json"(geojson或topojson)和"csv"。**(必选)**
*`path`:图层数据文件的路径(相对或绝对)。**(必需)**
*`id property`:数据文件中用作功能唯一标识符的属性。另请参见[topojson命令行文档](https://github.com/mbostock/topojson/wiki/command line reference)。
*`properties`:要保留在输出中的数据的属性列表。将删除所有其他属性。
*`all properties`:如果为true,则保留此层的所有属性。
*`where`:将筛选功能数据的类似sql的查询谓词。这将使用与[ogr2ogr]完全相同的查询语法(http://www.gdal.org/ogr2ogr.html)。
*`纬度':包含点/要素纬度的数据中的列的名称。
*`经度':包含点/要素经度的数据中的列的名称。
缓存的形状文件存储在`~/.mapturner`中。您可能希望定期清除此文件夹以释放空间并确保重新下载更新的形状文件。