zoukankan      html  css  js  c++  java
  • Building GDAL to support wildcards

    Building GDAL to support wildcards

    Earlier today, I was attempting to use the gdalbuildvrt utility function to create a virtual spatial datasource that combined a set of GeoTIFFs in a directory. The GeoTIFF files formed a set of perfectly tessellating images, from which I wanted to create a single tile layer to overlay on Bing Maps. If I’d have attempted to cut tiles from each GeoTIFF separately, I’d have been left with lots of separate layers – each containing unwanted edges. Alternatively, if I’d have stitched all the GeoTIFFs together first, I’d have to deal with one enormous, unwieldy image, several Gb in size.

    So, the VRT virtual datasource sounded like a good idea – it would provide the convenience of operating on the set of GeoTIFFS as if they’d have been one single contiguous image, but without the overhead of having to actually create that behemoth file. The benefits of my proposed approach are confirmed in the performance measurements given in this article.

    Unfortunately, I fell at the first hurdle when I got this error with only the most basic of gdalbuildvrt usage:

    image

    The error stated ERROR 4: ‘*.tif’’ does not exist in the file system, and is not recognised as a supported dataset name. Followed by Warning 1: Can’t open *.tif. Skipping it.

    There were most definitely TIFF files in this directory, saved with the .tif file extension. Removing the asterisk wildcard and pointing at a manual list of files worked ok, so what was wrong with the syntax of *.tif ?

    The answer is that if, like me, you built your GDAL from source, it is not configured by default to support wildcard expansion. To fix this, you have to edit GDAL’s nmake.opt file and, at line 155, insert the path to the setargv.obj of your Visual C installation. On my computer, this is installed in the default location of C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\setargv.obj. However, to make it a little trickier, you have to use the 8.3 short filename reference to this file. So, I changed my nmake.opt file to include the following line:

    SETARGV = “C:\PROGRA~2\MICROS~1.0\VC\lib\setargv.obj”

    (Note that following the comments in the file about setting the VCDIR and then providing a relative path didn’t work for me – SETARGV needed to be a complete absolute path to setargv.obj).

    Then, rebuilding the project and trying again, and I was good to go:

    image

    And, an extract from the created merged.vrt file:

  • 相关阅读:
    Java_io_02_从一个目录拷贝文件到另一个目录下
    JavaUtil_02_二维码的生成与解析
    Oracle_Exception_01_The Network Adapter could not establish the connection
    Linux_笔记_01_设置静态IP与 SecureCRT连接Linux
    Mybatis_笔记_01_逆向工程
    Java企业微信开发_Exception_02_java.security.InvalidKeyException: Illegal key size
    Java_总结_00_资源贴
    Java企业微信开发_06_素材管理之上传本地临时素材文件至微信服务器
    Java企业微信开发_05_消息推送之被动回复消息
    Java企业微信开发_04_消息推送之发送消息(主动)
  • 原文地址:https://www.cnblogs.com/loongfee/p/2383984.html
Copyright © 2011-2022 走看看