Convert a shapefile (.shp) to xml/json

前端 未结 5 891
隐瞒了意图╮
隐瞒了意图╮ 2020-12-22 15:55

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

5条回答
  •  我在风中等你
    2020-12-22 16:25

    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
    

    eg

    $ 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, ...
      ...
    

提交回复
热议问题