[Xastir] Re: Bounding boxes

Tom Russo russo at bogoflux.losalamos.nm.us
Wed Oct 8 00:59:22 EDT 2003


On Tue, Oct 07, 2003 at 04:03:37PM -0600, a Mr. Richard Feyler of Fort Lee, New Jersey <russo at bogoflux.losalamos.nm.us> writes 'Dear Rosanne Rosannadanna':
> On Tue, Oct 07, 2003 at 04:35:18PM -0400, a Mr. Richard Feyler of Fort Lee, New Jersey <tyler at allisonhouse.com> writes 'Dear Rosanne Rosannadanna':
> [his "b40.tif" file contains the geotiff data:]
> > 
> > Corner Coordinates:
> > Upper Left    (5205005.699,4299352.261)
> > Lower Left    (5205005.699,4253418.698)
> > Upper Right   (5241025.879,4299352.261)
> > Lower Right   (5241025.879,4253418.698)
> > Center        (5223015.789,4276385.479)
> > ---------------
> > 
> > What would the FGD file need to be?
> 
> Unfortunately, the FGD file is the least of your worries.
> 
> I visited the Kentucky site you point to (http://kymartian.ky.gov/) and 
> see that the maps you are downloading aren't USGS maps georeferenced to the
> UTM system with the NAD83 datum, but rather processed versions of the USGS
> maps georeferenced to the Kentucky Single Zone State Plane system.  
[...]
> 
> I don't think that Xastir is set up to use the projection library in its most
> general sense --- you'd basically have to read in each pixel in the image,
> get its state plane coordinate via (coord1=5205005.699+6.6667*pixel x coord,
> coord2=4299352.261-6.6667*pixel y coord), then transform that state plane
> coordinate to lat/lon appropriately, then plot the pixel.  As far as I know,
> Xastir's only set up to do that transformation for UTM.  

Hate to drag this thread on too long, but you've tickled my interest
with your problem, and inspired me to dig for more information than
I'd normally bother digging for.

> Doable, but not a
> matter of just setting up an FGD file or tweaking the geotiff metadata.

Turns out it was probably incorrect of me to say that Xastir wasn't
set up to use anything but UTM projected tiff files, and while I still
claim that "tweaking" the geotiff metadata isn't enough, "twiddling"
the data *might* be enough. (see
<http://catb.org/esr/jargon/html/F/frobnicate.html> for the distinction)

Xastir uses the libgeotiff functions GTIFImageToPCS and
GTIFProj4ToLatLong functions to map tiff file contents to the screen,
and prior to that uses the GTIFGetDefn function to extract projection
data from the geotiff metadata.  If (that's a big if) the geotiff file
contains the correct metadata to define the projection then it could
conceivably be the case that Xastir would read any old geotiff,
regardless of the projection.

The problem is that the tiff files you got from the Kentucky web site
have almost none of the projection-related metadata.  If you were
really keen on getting them to work, you could probably glean the
correct parameters from <http://giac.state.ky.us/kyspcs.htm>, and then
work your way through the geotiff specs to figure out what the right
set of metadata are to specify a user-defined "PCS" (projected
coordinate system).  I've been pouring over the geotiff spec for a
while now, and don't see immediately what the metadata file should
look like, but there are some examples in the "cookbook" that look
like they might be close (see, for example, the "common example" of an
aeronautical chart at
<http://www.remotesensing.org/geotiff/spec/geotiff3.html#3.1.3.>,
which uses the same two-parallel version of the Lambert conformal
conic projection that the Kentucky Single Zone State Plane system
uses.  It might be close enough to use as a model for your own
metadata file, which you could then stuff into the tiff files with
geotifcp.  Some differences I see immediately are that the KSZSP
system uses US Survey feet as the units rather than meters, and uses
NAD83 not NAD27 --- find the appropriate codes for those changes
(available somewhere in the geotiff spec), replace the standard
parallels, center meridian, false easting and northing, keep the
tiepoints and scales that you already have and you might be close.
Maybe.  

Did I use enough weasel words there?

And to tie all this back to the origin of the thread (USGS DRG no
longer free), I went back to the place I last bought USGS DRGs from
over two years ago --- the USGS "EarthExplorer" site --- and see that
the price hasn't changed in over two years.  $30 set-up fee, $1 per
map if you order them to be FTPd rather than on CD.  I bought a
boatload of DRGs, DEMs and DLGs of my local area back then.  Depending
on how many you *really* need, that's not really that expensive, and a
whole heck of a lot cheaper than I've ever paid for paper maps from
USGS.  Personally, I'd rather pay that than bother hacking the
metadata on non-USGS maps to save the bucks :-)

-- 
Tom Russo   KM5VY    QRPL #1592   K2#398    http://www.swcp.com/~russo/
Tijeras, NM DM64ux   SOC #236     AHTB#1    http://www.qsl.net/~km5vy/
 "Evil.  Good.  These are moral absolutes that predate the fermentation of
  malt and fine hops.  If beer had been invented first, there'd be only
  'Kinda nice' and 'Pretty cool'."  
       -- Season 4, Buffy the Vampire Slayer, "Beer Bad"



More information about the Xastir mailing list