[Gdal-dev] Help a stupid GIS newbie: gdalwarp for GPSDrive maps
Ed McNierney
ed at topozone.com
Fri Sep 10 22:50:25 EDT 2004
Sean -
OK, let's bark up that tree for a minute. We can figure out how to
generate the map_koord.txt file once we figure out the projection stuff.
What units does the scale appear to use? Is the scale number very small
for "typical" maps? If so, it's probably in degrees. Otherwise my next
guess would be meters.
As far as your gdalwarp command line goes, you're missing the
information that would be found in the world file; you need to create a
file for your TerraServer source JPEG. This file has the same root name
as the image, with the extension .WLD or .JGW (either is OK).
Are you retrieving the TerraServer images using the TerraServer
"Download" service? If so, you can download world files, too (see menu
on the left, instructions below the image). If you're retrieving the
TerraServer image through some other interface, then you must be passing
coordinates with that request and you can construct the world file from
the parameters you're using. Let us know how you're getting the source
image, and we can at least complete the source image half of the
equation.
- Ed
-----Original Message-----
From: gdal-dev-bounces at xserve.flids.com
[mailto:gdal-dev-bounces at xserve.flids.com] On Behalf Of S Clark
Sent: Friday, September 10, 2004 10:20 PM
To: gdal-dev at xserve.flids.com
Subject: Re: [Gdal-dev] Help a stupid GIS newbie: gdalwarp for GPSDrive
maps
No, 'fraid not. I was referring to the "map_koord.txt" file that goes
with GPSDrive and contains 4 fields per line:
(filename) (center latitude) (center longitude) ("scale")
for every map image file that GPSDrive is to try to use.
That's, effectively, about all of the information I have for most of
these images (other than the projection type of the source [usually UTM]
and target [geographic/equirectangular/whatever, or miller(?)] images,
and the fact that the image is always 1280x1024 pixels).
If it helps, here's what I'm attempting so far:
/usr/bin/gdalwarp -s_srs '+proj=utm +zone=12 +datum=WGS84 +k=0.9996'
-t_srs '+proj=eqc +lat_ts=42.94584 +lon_0=-113.2167 +datum=WGS84'
map_42.94584_-113.2167_5512.jpeg top_kings_bowl.jpg ERROR 1: Unable to
compute a transformation between pixel/line and georeferenced
coordinates for map_42.94584_-113.2167_5512.jpeg.
There is no affine transformation and no GCPs.
Obviously, there's information missing that I need to supply to
gdalwarp, but I'm neither sure exactly what information, nor how it's
labeled in the *_srs fields...
(The example above is a Terraserver aerial photo of the "King's Bowl"
crater in southeastern Idaho, near American Falls. The filename
containing coordinates and scale is just a convention I've adopted to
make remembering what they are easier, and doesn't matter to
GPSDrive.)
If it helps, I DON'T intend to change the map "scale", merely to warp
the image to match either geographic/equirectangular/plate caree or
"whatever expedia is, possibly Miller" projection.
Getting the X and Y coordinates of the ORIGINAL (non-geographic) image's
upper-left corner seems to be a sticking point - I gather that's not a
straightforward proposition for most projections. On the other hand,
calculating the upper-left X and Y for the "target"
geographic-projection image is trivial. If I can supply that for the
target, will gdalwarp be able to back-calculate the the coordinates for
the original (usually UTM) source image was, given that the scale
doesn't change?
For calculating the parameters of what I've been calling the
"equirectangular"
image ("top_*" in GPSDrive), here a snippet of the code I've been using
successfully:
-----------------------------------
$degpixel = floatval($scale/313687320); //degrees/pixel for
equirectangular map (calc'd from GPSDrive code) $lat=floatval($lat);
$lon=floatval($lon); $ullon=$lon-($degpixel*640); //upper-left
longitude boundary $ullat=$lat+($degpixel*512); //upper-left latitude
boundary $lrlon=$lon+($degpixel*640); //lower-right longitude boundary
$lrlat=$lat-($degpixel*512); //lower-right latitude boundary
-----------------------------------
Thanks (yet again),
Sean
On Friday 10 September 2004 07:43 pm, you wrote:
> Sean -
>
> Is that "supplementary text file" an ESRI-format world file? If so,
> it would be a text file with six lines in it, each of which contains a
> number - and the second and third lines are almost certainly 0.0.
>
> If that's the case, then the first and fourth lines will contain the X
> pixel size and the Y pixel size, in units of degrees. The fifth and
> sixth lines are the X and Y coordinates of the upper-left corner of
> the image (also in degrees). Does that look right?
>
> - Ed
_______________________________________________
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