将shapefile(.shp)转换为xml/json [英] Convert a shapefile (.shp) to xml/json
本文介绍了将shapefile(.shp)转换为xml/json的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用shapefile(.shp,.dbf等)并将其转换为xml.我在Mac上,无法找到可以帮助我进行转换的应用程序.有谁知道将这种文件格式转换为xml文件的方法?
I'm working with a shapefile (.shp, .dbf, etc) and would like to convert it to xml. I'm on a mac, and I'm having trouble finding an application that will help me with the conversion. Does anyone know of a method for converting this file format into an xml file?
推荐答案
dassouki说了什么.从 http://www.kyngchaos.com/software:frameworks 中获取GDAL.使用它将shapefile转换为 GeoJSON ,如下所示:
What dassouki said. Get GDAL from http://www.kyngchaos.com/software:frameworks. Use it to convert a shapefile to GeoJSON like this:
$ ogr2ogr -f "GeoJSON" output.json input.shp
例如
$ ogr2ogr -f "GeoJSON" /tmp/world.json world_borders.shp world_borders
$ cat /tmp/world.json
{
"type": "FeatureCollection",
"features": [
{ "type": "Feature", "properties": { "CAT": 1.000000, "FIPS_CNTRY": "AA",
"CNTRY_NAME": "Aruba", "AREA": 193.000000, "POP_CNTRY": 71218.000000 },
"geometry": { "type": "Polygon", "coordinates": [ [ [ -69.882233, ...
...
这篇关于将shapefile(.shp)转换为xml/json的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文