欢迎您来到GIS动力

加入收藏 免费注册 用户登陆 帮助中心
首页 新闻动态 技术专栏 银杏树下 学习考研 软件下载 求职招聘 许愿瓶 节日祝福 用户中心 精彩推荐 资源搜索 地图
专栏导航: AO开发 | SO开发 | ArcGIS桌面 | 超图桌面 | 开发语言 | 数据库 | WebGIS | 银杏文学 | 研究生考题 | FreeMap FreeTalk
   您现在位于: 首页技术专栏地理信息技术 → 正文
GDAL带的影像合并Python代码
07-10-16 09:04:49 作者:flyingfish 出处:flyingfish
ps:最近用vc作遥感影像的入库功能,借助GDAL来做,基本已经可以使用了。最后要写段代码对建立好的金字塔作合并输出,再次翻看了gdal_merge.py,其实这段代码很早就看过,尽管道理不复杂,但看到Frank把代码写的这么精致,不由肃然起敬,放到这里经常来看看勉励自己。
    写代码有好几年了,现在才深刻体会到软件设计模式、架构、文档、规范的重要性,反而感觉做工作时有些瞻前顾后,总想把代码的逻辑整的很清晰以提高可维护行和复用性,真是那个 阶段有哪个阶段的烦恼,呵呵!

  1
  # !/usr/bin/env python
  2  # ##############################################################################
  3  #  $Id: gdal_merge.py,v 1.25 2006/04/20 13:27:57 fwarmerdam Exp $
  4  #
  5  #  Project:  InSAR Peppers
  6  #  Purpose:  Module to extract data from many rasters into one output.
  7  #  Author:   Frank Warmerdam, warmerdam@pobox.com
  8  #
  9  # ##############################################################################
 10  #  Copyright (c) 2000, Atlantis Scientific Inc. (www.atlsci.com)
 11  #  
 12  #  This library is free software; you can redistribute it and/or
 13  #  modify it under the terms of the GNU Library General Public
 14  #  License as published by the Free Software Foundation; either
 15  #  version 2 of the License, or (at your option) any later version.
 16  #  
 17  #  This library is distributed in the hope that it will be useful,
 18  #  but WITHOUT ANY WARRANTY; without even the implied warranty of
 19  #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 20  #  Library General Public License for more details.
 21  #  
 22  #  You should have received a copy of the GNU Library General Public
 23  #  License along with this library; if not, write to the
 24  #  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 25  #  Boston, MA 02111-1307, USA.
 26  # ##############################################################################
 27  #  
 28  #   $Log: gdal_merge.py,v $
 29  #   Revision 1.25  2006/04/20 13:27:57  fwarmerdam
 30  #   Added error checks on Driver's Create support and success of Create.
 31  #
 32  #   Revision 1.24  2006/01/26 23:40:39  fwarmerdam
 33  #   treat nodata as a float.
 34  #
 35  #   Revision 1.23  2005/11/25 02:13:36  fwarmerdam
 36  #   Added --help-general.
 37  #
 38  #   Revision 1.22  2005/11/16 18:30:49  fwarmerdam
 39  #   Fixed round off issue with output file size.
 40  #
 41  #   Revision 1.21  2005/08/18 15:45:15  fwarmerdam
 42  #   Added the -createonly switch.
 43  #
 44  #   Revision 1.20  2005/07/19 03:33:39  fwarmerdam
 45  #   removed left over global_list
 46  #
 47  #   Revision 1.19  2005/06/23 19:51:51  fwarmerdam
 48  #   Fixed support for non-square pixels c/o Matt Giger
 49  #   http://bugzilla.remotesensing.org/show_bug.cgi?id=874
 50  #
 51  #   Revision 1.18  2005/03/29 22:40:00  fwarmerdam
 52  #   Added -ot option.
 53  #
 54  #   Revision 1.17  2005/02/23 18:29:07  fwarmerdam
 55  #   Accept "either spelling" of separate.
 56  #
 57  #   Revision 1.16  2005/02/23 18:23:00  fwarmerdam
 58  #   Added -seperate to the usage message.
 59  #
 60  #   Revision 1.15  2004/09/02 22:06:24  warmerda
 61  #   Added a bit of commandline error reporting.
 62  #
 63  #   Revision 1.14  2004/08/23 15:05:27  warmerda
 64  #   Added projection setting for new files.
 65  #
 66  #   Revision 1.13  2004/04/02 22:31:26  warmerda
 67  #   Use -of for format.
 68  #
 69  #   Revision 1.12  2004/04/02 17:40:44  warmerda
 70  #   added GDALGeneralCmdLineProcessor() support
 71  #
 72  #   Revision 1.11  2004/03/26 17:11:42  warmerda
 73  #   added -init
 74  #
 75  #   Revision 1.10  2003/04/22 14:42:45  warmerda
 76  #   Don't import Numeric unless we need it.
 77  #
 78  #   Revision 1.9  2003/04/22 13:30:05  warmerda
 79  #   Added -co flag.
 80  #
 81  #   Revision 1.8  2003/03/07 16:26:39  warmerda
 82  #   fixed up for ungeoreferenced files, supress extra error
 83  #
 84  #   Revision 1.7  2003/01/28 15:00:13  warmerda
 85  #   applied patch for multi-band support from Ken Boss
 86  #
 87  #   Revision 1.6  2003/01/20 22:19:08  warmerda
 88  #   added nodata support
 89  #
 90  #   Revision 1.5  2002/12/12 14:54:42  warmerda
 91  #   added the -pct flag to copy over a pct
 92  #
 93  #   Revision 1.4  2002/12/12 14:48:12  warmerda
 94  #   removed broken options arg to gdal.Create()
 95  #
 96  #   Revision 1.3  2002/04/03 21:12:05  warmerda
 97  #   added -separate flag for Gerald Buckmaster
 98  #
 99  #   Revision 1.2  2000/11/29 20:36:18  warmerda
100  #   allow output file to be preexisting
101  #
102  #   Revision 1.1  2000/11/29 20:23:13  warmerda
9 7 3 1 2 3 4 5 6 4 8 :

(本文已被浏览 次)
发布人:admin
推荐给好友:发送给好友
上篇新闻:
下篇新闻:
相关评论
发表我的评论
  • 尊重网上道德,遵守《全国人大常委会关于维护互联网安全的决定》及中华人民共和国其他各项有关法律法;
  • 本站有权保留或删除您发表的任何评论内容;
  •   相关文章  

    关于我们友情链接 ┋ 与我在线 ┋ 管理 ┋ TOP
     
    网站当前版本:GisPower CMS V3.0
    『GIS 动力』- http://www.gispower.org/
    联系我们:webmaster#gispower.org
    Copyright (c) 2003-2007 GisPOwer.Org. All Rights Reserved.
     

                   滇ICP备05006901号