[Gdal-dev] trouble converting units in raster images
Frank Warmerdam
warmerdam at pobox.com
Fri Nov 4 23:37:56 EST 2005
On 11/4/05, Jeff Hoffmann <jeff at propertykey.com> wrote:
> Jeff Hoffmann wrote:
> > I have a raster layer that is composed of a few hundred GeoTIFF files;
> > all of the files are NAD83 / Alabama West, although some have the units
> > set to meters, other are feet. I'm trying to get them all to the same
> > units, but I can't figure out how to do that. I'm trying to do it with
> > gdalwarp (with parameters "-s_srs '+init=epsg:26930 +units=ft' -t_srs
> > '+init=epsg:26930'"). I'm using GDAL version 1.3.1.0. The command
> > changes the coordinate system information when I do a gdalinfo on the
> > file, but the origin, pixel size, corner coordinates all stay the same
> > numbers. Is there something I'm not doing right? It seems like it
> > should be pretty straightforward. Or is there some other way to
> > accomplish this if it just won't work?
>
> OK, I feel a little stupid now, but also a little confused. To get this
> to work, I removed the "-s_srs '+init=epsg:26930 +units=ft'" and just
> used the "-t_srs '+init=epsg:26930'". I don't know why that worked
> because the source SRS parameter should match what was in the file, but
> apparently something must be different. That's not the confusing part,
> though. I tried a bunch of different parameter combinations and
> sometimes I would delete the existing target file and sometimes I
> wouldn't. It would just happily run if there was an existing target
> file (or at least it didn't give me an error) but the corner
> coordinates/pixel size always stayed the same even though the units
> changed (the coordinate system information did get updated from ft->m).
Jeff,
I don't believe that '+init=epsg:26930 +units=ft' does what you
want with GDAL. GDAL has it's own PROJ.4 coordinate system
parsing logic which would kick in for this case, but GDAL's PROJ.4
parsing is rather incomplete.
Amoung other things, it doesn't know about init files, but does
have a special case to expand EPSG projections for +init=epsg:###.
But in this case it ignores everything else and takes the EPSG
definition without modification.
What you can do is just use the full EPSG:26930, and replace
+units=m with +units=ft.
eg.
+proj=lcc +lat_1=37.93333333333333 +lat_2=36.73333333333333
+lat_0=36.33333333333334 +lon_0=-85.75 +x_0=500000 +y_0=500000
+ellps=GRS80 +datum=NAD83 +units=ft
So, use that as -s_srs in your gdalwarp, and the normal
version as -t_srs. That _should_ work.
Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent
More information about the Gdal-dev
mailing list