[Gdal-dev] read prj & metadata from .html file?

Ed McNierney ed at topozone.com
Tue Feb 1 21:40:35 EST 2005


Matt -

>From the GDAL output you sent me separately, it appears that your
fundamental problem is that you have GeoTIFFs described by EPSG
projection codes (such as 26702, NAD27 UTM Zone 2 N) that are not
installed on your system.  Updating your EPSG projection definitions to
include the values reported by the GeoTIFFs you're using is probably the
quickest, simplest, and most reliable route to a solution.

     - Ed

Ed McNierney
TopoZone.com

-----Original Message-----
From: gdal-dev-bounces at xserve.flids.com
[mailto:gdal-dev-bounces at xserve.flids.com] On Behalf Of Matt Wilkie
Sent: Tuesday, February 01, 2005 7:39 PM
To: gdal-dev at xserve.flids.com
Subject: Re: [Gdal-dev] read prj & metadata from .html file?

> I half expected that would be your stance. I was hoping that someone 
> would chime in with a script they'd already built. :) Guess I'll try
and 
> figure out how to do it myself.

Okay here is a quick and dirty bash script which works about 80% of the 
time -- on the DRGs I've tested (only about 100!). It fails where the 
structure of the html file is slightly different from the norm, for 
example an extra space before the Zone number or something.

The only parameter it grabs from the metadata html file is the UTM Zone 
number.

Process-list.txt prepared ahead of time and looks like:
	c70141a1
	c70141a1
	c70144a1
	c51178c1
where each number corresponds to the tif filename (c51178c1.tif)

#!/bin/sh
for drg in `<process-list`; do
     # get the UTM Zone number
     DRGZONE=`grep Zone $drg.html | sed -e 's/<.*> *//' -`
     #translate and set prj info
     gdal_translate -a_srs "+proj=utm +datum=nad27 +zone=$DRGZONE" -co 
"COMPRESS=PACKBITS" $drg.tif out/$drg.tif
     # clean up
     DRGZONE=
     done
echo.
echo Watch for Zones which look out of range:
echo.
for img in *.tif; do
     gdalinfo $img |grep -i zone
     done
#/end of script/


cheers,

-- 
matt wilkie
--------------------------------------------
Geographic Information,
Information Management and Technology,
Yukon Department of Environment
10 Burns Road * Whitehorse, Yukon * Y1A 4Y9
867-667-8133 Tel * 867-393-7003 Fax
--------------------------------------------

_______________________________________________
Gdal-dev mailing list
Gdal-dev at xserve.flids.com
http://xserve.flids.com/mailman/listinfo/gdal-dev



More information about the Gdal-dev mailing list