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:

  • 相关阅读:
    MySQL Generic Binaries包和RPM包的区别?
    实体零售如何构建数据管理体系及未来方向
    python3 数据分析
    power designer 资料库表查询
    PowerDesigner 连接资料库
    电商数据分析的基本指标体系
    初中数学动点最值问题19大模型+例题详解
    初中数学全年级26个专题知识点精编汇总
    Python数据分析学习路径拆解及资源推荐
    十种常用的数据分析方法
  • 原文地址:https://www.cnblogs.com/loongfee/p/2383984.html
Copyright © 2011-2022 走看看