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. 记一次排查log4net 不输出日志的解决过程

    最近发现log4net 不输出日志了,重点排查几个地方,发现都没有问题. 1.[assembly: log4net.Config.XmlConfigurator(ConfigFile = " ...

  2. centos7/redhat7 将网卡名字改成eth样式的方法

    方法/步骤    1. 编辑 /etc/sysconfig/grub 找到“GRUB_CMDLINE_LINUX”这一行 

  3. php中使用curl两个例子

    第一个例子: 调用一个天气预告的接口 $data = 'theCityName=石家庄'; $cUrl = curl_init(); curl_setopt($cUrl, CURLOPT_URL, & ...

  4. kinect for windows - DepthBasics-D2D详解之二

    通过上篇文章,我们了解了在视频图像从kinect开发包传输到应用程序之前的一系列初始化工作,那么这篇文章主要来叙述,如何将一帧图像数据获取到,并显示出来的. 更新窗口是在Run函数消息处理中,当Kin ...

  5. (Java随机数举例)随机扔一千次硬币的正反次数

    方法一: public class coin{ public static void main(String args[]){ int n = 0; int m = 0; int len = 1000 ...

  6. android 中的 ViewPager+ Fragment

    android的Viewpager 的各种经常的用法,朋友问我要过,所以就稍微总结一下, ViewPager + Fragment 经常用到  代码是从   actionbarsherlock 中提取 ...

  7. switch语句:适用于一个条件有多个分支的情况---分支语句

    例1: 客服选择功能,然后按按键 Console.WriteLine("查花费请按1,查余额请按2,查流量请按3,办理业务请按4,宽带请按5,人工服务请按6,集团业务请按7"); ...

  8. 素数环(C - 暴力求解)

    素数环(暴力)(紫书194页) Description   A ring is composed of n (even number) circles as shown in diagram. Put ...

  9. CoinChange

    题目 题目:CoinChange 有面额不等的coins,数量无限,要求以最少的\(coins\)凑齐所需要的\(amount\). 若能,返回所需的最少coins的数量,若不能,返回-1. Exam ...

  10. Cocos2dx项目移植Android平台

    链接地址:http://blog.csdn.net/iuncle/article/details/24772183 版权声明:本文为博主原创文章,未经博主允许不得转载. 1.Classes目录下存放. ...