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 boot在整合项目依赖的问题

    最近要开发新的项目,就花了几天时间看了下spring boot的相关资料,然后做了一个demo,不得不说开发效率确实很快,几行注解就完成了事务,aop,数据库等相关配置:但由于先前习惯了spring ...

  2. 【Linux命令】查找命令

    如果你想在当前目录下 查找"hello,world!"字符串,可以这样: grep -rn "hello,world!" *

  3. COM编程-注册DLL形式的COM服务器

    这篇文章不涉及任何的有关COM的技术的讲解,仅仅的说一下写好的DLL形式的COM怎么使用.如下图所示,我已经有了一个DLL形式的COM服务器和一个使用COM服务器的COM客户端: 现在这个DLL的CO ...

  4. MongoDB学习笔记1(简介)

    一.简介                 1.丰富的数据类型         MongoDB是一种非关系型数据库,是面向文档的数据库.         MongoDB没有模式,文档的键不会事先定义,也 ...

  5. YII2 实现登录时候修改最新登录时间

    YII2 实现登录时候修改最新登录时间 YII2保存最新登录时间主要技巧:为 EVENT_AFTER_LOGIN 事件绑定一个方法,在方法中保存最新时间 public function login() ...

  6. projecteuler之58题Spiral primes

    package com.android; public class SpiralPrimes { public static void main(String args[]) { long numPr ...

  7. [翻译]Django速查表

    原文在此:https://code.djangoproject.com/wiki/DjangoCheatSheet Django速查表Django教程已经非常好了.这个速查表的作用是创建一个快速开始指 ...

  8. django virtualenv

    1. virtualenv virtualenv用于创建独立的Python环境,多个Python相互独立,互不影响,它能够:1. 在没有权限的情况下安装新套件2. 不同应用可以使用不同的套件版本3. ...

  9. 设计模式总结4--singleton pattern

    单例模式 保证每个类只有一个实例,并提供一个全局访问点 第一步 构造方法私有化第二步 公有化静态方法获取的实例 懒汉式  public class Bank{ private Bank(){} pri ...

  10. perl学习(3) 列表

      列表或称为数组,和c语言中的数据类似,只是perl自己特殊的一些写法. 1.1.定义 一个列表或者数组可以包含数字,字符串,undef 值,或者任意不同类型的标量值的组合,但是这些元素的类型通常是 ...