博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
OGR – Merging Multiple SHP files
阅读量:5280 次
发布时间:2019-06-14

本文共 1137 字,大约阅读时间需要 3 分钟。

So I have 25 shapefiles with data for 25 counties, and I want to merge them all into one shapefile.

Using OGR,:

ogr2ogr merge.shp file1.shp

ogr2ogr -update -append merged.shp file2.shp -nln merge

You create a new shapefile merged and copy the contents of file1 into the new shapefile. Then you append the contents of file2 to the newly created shapefile and name it merged.

What do you do if you don’t want to do this 25 times ?

On page 22 of this document () is a Python script for doing this. But I couldn’t get the Python bindings for GDAL to work. The errors were always with importing _gdal which I understand is the gdal dll and references to _gdal are created by . I don’t care about the script. I can write my own. But I would like to get GDAL(OGR) working from Python.

So after giving up on this concept temporarily, I resorted to Windows scripting, as modified from :

as above, use: ogr2ogr merge.shp file1.shp to create a shapefile mergecontaining the data of file1

then:

for %f in (*.shp) do (

ogr2ogr -update -append merge.shp %f  -f “esri shapefile” -nln merge )
That worked.

转载于:https://www.cnblogs.com/mfryf/p/3556460.html

你可能感兴趣的文章
php每天一题:strlen()与mb_strlen()的作用分别是什么
查看>>
工作中收集JSCRIPT代码之(下拉框篇)
查看>>
《转载》POI导出excel日期格式
查看>>
code异常处理
查看>>
git - 搭建最简单的git server
查看>>
会话控制
查看>>
推荐一款UI设计软件Balsamiq Mockups
查看>>
Linux crontab 命令格式与详细例子
查看>>
百度地图Api进阶教程-地图鼠标左右键操作实例和鼠标样式6.html
查看>>
游标使用
查看>>
LLBL Gen Pro 设计器使用指南
查看>>
SetCapture() & ReleaseCapture() 捕获窗口外的【松开左键事件】: WM_LBUTTONUP
查看>>
Android 设置界面的圆角选项
查看>>
百度地图api服务端根据经纬度得到地址
查看>>
根据xml生成相应的对象类
查看>>
Android StageFrightMediaScanner源码解析
查看>>
springBoot 项目 jar/war打包 并运行
查看>>
HDU 1501 Zipper
查看>>
打包java程序生成exe
查看>>
八叉树
查看>>