[Xastir] Re: Transverse Mercator problems

russo at bogodyn.org russo at bogodyn.org
Mon Sep 27 18:46:03 EDT 2004


On Mon, 27 Sep 2004, Curt Mills wrote:
>On Mon, 27 Sep 2004, Stuart L. Morris wrote:
>
>> I've been using Xastir for a while with all sorts of maps but recently I
>> have tried using some TM tiles and I'm having real problems.
>>
>> The problem appears to be that the tiles (2000 pixels on each side,
>> 10kmx10km) are being rendered as square by Xastir when at my latitude
>> (51:27:05.34, -00:56:55.8)  the should be rotated slightly clockwise.
>>
>> Does anyone have any suggestions or is this a limitation of Xastir and
>> I'm going to have to work out a way of modifying my tiles (all 4.5Gb)!
>
>Simple answer is that we don't rotate.  Slightly more complicated
>answer is that we do in only one case:  geoTIFF maps, but that code
>is not generalized to handle just anything.  It only handles USGS
>geoTIFF DRG maps.
>
>Perhaps the ogr2ogr program might be able to convert these to the
>correct projection?

No, ogr2ogr only works on vector data.  gdalwarp is the one to play
with for rasters.  If given a georeferenced raster, gdalwarp can warp
any supported raster type in any projection to any other.  But since
the map in question is an ungeoreferenced xpm being georeferenced only
through tiepoints in a .geo file, that's no help.  There might be a
way to use gdalwarp to import an ungeoreferenced image (it can read
xpm files), and output a georeferenced, warped image with just the
right set of command line options, but I don't immediately see how to
do it given the sparse documentation of that tool.

The .geo handling of transverse mercator maps in xastir might just be
incorrect.  In a strict sense, so is the handling of geoTIFF maps in
UTM, but for most cases it's close enough for casual use.

If one desired to get around these limitations without fixing map_geo.c, one
could possibly convert the xpm file to TIFF format, generate a metadata file
with the right metadata for the Transerse Mercator projection used, install
it into the TIFF file using geotifcp, then either use that directly or
warp it in to lat/lon (xastir now supports lat/lon geotiff rasters, and
if those are produced with gdalwarp then the slightly inaccurate handling
of UTM geotiffs is also bypassed).

I once wrote a script to insert such metadata into ungeoreferenced tiff files
in response to another question on this list, at least a year ago.  I'll see
if I can find it befory Gerry pipes in with the absolutely correct answer.

--
Tom Russo    KM5VY   SAR502   DM64ux          http://www.swcp.com/~russo/
Tijeras, NM  QRPL#1592 K2#398  SOC#236 AHTB#1 http://www.qsl.net/~km5vy/
  As a confirmed melancholic, I can testify that the best and maybe only
  antidote for melancholia is action. However, like most melancholics, I
  suffer also from sloth. -- Edward Abbey, American anarchist




More information about the Xastir mailing list