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

Using OGR,you can merge 2 files like this:

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 (Using GDAL / OGR for Data Processing and Analysis) 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 SWIG. 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 this page:

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.

OGR – Merging Multiple SHP files的更多相关文章

  1. Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define ...

    Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define ... 这个错误是因为有两个相 ...

  2. 导入项目时,有关[2016-04-03 20:38:02 - Dex Loader] Unable to execute dex: Multiple dex files 问题

    最近我在学习androidUI设计,在网上找了一个UI菜单界面开源代码示例,按照步骤导入项目,运行的时候控制台结果报了如下错误: [2016-04-03 20:38:02 - Dex Loader] ...

  3. Multiple dex files define Lcom/google/zxing/BarcodeFormat

    解决zxing “Could not find class 'com.goole.zxing.Result”和“Multiple dex files define”问题 时间 2014-04-24 1 ...

  4. 用Eclipse运行Android版APP(PhoneGap)时出现:Unable to execute dex: Multiple dex files define

    这两天遇到点小问题,做个记录: 症状:运行,调试时都报:Unable to execute dex: Multiple dex files define错误,发布后的APP安装到手机后一运行,就提示: ...

  5. TN035: Using Multiple Resource Files and Header Files with Visual C++

    TN035: Using Multiple Resource Files and Header Files with Visual C++ This note describes how the Vi ...

  6. Unable to execute dex: Multiple dex files define Lcom/gl

    [2015-04-16 17:42:04 - Dex Loader] Unable to execute dex: Multiple dex files define Lcom/gl/softphon ...

  7. “Unable to execute dex: Multiple dex files”如何解决?

    遇到报错: [2014-02-13 17:27:03 - Dex Loader] Unable to execute dex: Multiple dex files define Lcom/kkdia ...

  8. Multiple dex files define

    Multiple dex files define 在项目中,有一个类的包名和引用的jar包中的类和包名一致

  9. Struts – Multiple configuration files example

    Many developers like to put all Struts related stuff (action, form) into a single Struts configurati ...

随机推荐

  1. 【转】 利用spring的profile切换不同的环境

    <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.sp ...

  2. 杭电oj An easy problem

    </pre><h1 style="color: rgb(26, 92, 200);">An easy problem</h1><stron ...

  3. windows7 安装python

    首先去Python官网,https://www.python.org 找到downloads,我这里系统是win7 x64,下载的是最新版本3.4.2 下载完成后有个msi文件,选择文件安装目录,一路 ...

  4. 虚拟环境管理工具virtualenvwrapper-win初试

    virtualenv 用于建立虚拟目录,但是每次进入指定虚拟都必须activate, 而且如果一个环境很久没用了,不记得环境所在目录,就会遗忘该环境,virtualenvwrapper 正是解决以上问 ...

  5. Hadoop2.6 Ha 安装

    Hadoop 2.6安装文档 版本说明:hadoop 2.6  linux-64位 Zookeeper3.4.6 jdk 1.7.0_75 1.       Ssh无密码 ssh-keygen vim ...

  6. jQuery.form 中的 ajaxForm() 和 ajaxSubmit()

    官方例子  http://malsup.com/jquery/form/#ajaxForm官方API   http://malsup.com/jquery/form/#api中文API   http: ...

  7. WPF:使用Json.NET在TreeView中树形显示JSON数据

    原文 WPF:使用Json.NET在TreeView中树形显示JSON数据 据 读者可以参考这个开源的可以树形显示XML和JSON的工具: Mgen Object 603:XML/JSON树形显示小工 ...

  8. 如何修改Sublime 侧边栏Sidebar的颜色

    参考自:http://blog.csdn.net/a497393102/article/details/10563791 首先要找到 Default.sublime-theme 文件, 点击 subl ...

  9. UI常用控件的一些属性

    UILable 1 //设置文本信息 2 nameLable.text = @"用户名:"; 3 //对齐方式(居中 居左 局右); 4 nameLable.textAlignme ...

  10. Web Deploy发布网站一条龙解决方案

    Web Deploy工具对于ASP.NET开发人员来说一定不陌生,没有用过也经常见到,Web Deploy发布十分方便而且在发布时会帮助用户检验发布文件的正确性.接下来介绍一下基础使用. 第一步:安装 ...