[OSM-talk] gdalwarp question

Torsten Mohr tmohr at s.netic.de
Sat May 2 16:53:06 BST 2009


Hello,

i got much further converting an image with gdalwarp, mainly with these two
links:

http://egb13.net/2009/04/bending-the-earth-gdalwarp-and-the-blue-marble/
http://en.wikipedia.org/wiki/World_file

Basically i got the "blue marble" (high quality TIF image of the earth,
consists of two files, west and east, each has 21600 x 21600 pixel.

So i split the image into 8 strips, each 5400 x 21600.

For example str_4.tif is the 4th strip going fromnorth pole to south pole
left goes through Greenwhich, right stops just before the Horn of Africa
(west side).

I've created a "world file" str_4.tfw (i've added the comments just now):
0.00833333333333333333 # delta x in angles per pixel
0.00  # no rotation
0.00  # no rotation
-0.00833333333333333333 # delta y in angles per pixel
0.0  # upper left corner X
90.0 # upper left corner Y

Now i call gdalwarp to convert it to the SRS used in osm.xml:

gdalwarp
-s_srs EPSG:4326 
-t_srs '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 
+y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs +over'
str_4.tif 
cstr_4.tif

But cstr_4.tif is "distorted", Africa is at 20% from the top, 40% from the top
begins Antarctica and goes down to the bottom (100%).


Is the "world file" incorrect?  Is the call to gdalwarp incorrect?

It would be great if anybody got a hint for me.


Also, i didn't find any explanation for the options of gdalwarp or
the parts in an SRS.  If anybody got an explanation that would be
appreciated.


Best regards,
Torsten.



Am Freitag, 1. Mai 2009 21:25:07 schrieb Juan Lucas Dominguez Rubio:
> > Hello, i have an image that can be wrapped around
> > a sphere, its x / y coordinates directly map to latitude / longitude.
>
> What do you mean by that?
> Do you mean that when you open it with some GIS app, the status bar tells
> the correct (lat, lon) of the place where the mouse is? Some GIS apps
> reproject raster files by default without explicitly letting the user know.
> Use this utility and tell us the output:
>
> gdalinfo <filename>
>
> > Is that enough information to tell the SRS of that image?
>
> Strictly, no, but if we talk about (lat, lon), the EPSG:4326 coordinate
> system is by far the most common, so if your coordinates are originally in
> (lat, lon), they are very likely to be in EPSG:4326.
>
> > Background is that i'd like to transform that image so it matches
> > the SRS used in osm.xml.  Would that be WGS84?  Or is it called
> > epsg:4326?  (Do they mean the same?)
>
> Yes, informally, when people say WGS84 they mean EPSG:4326. Ask Mr Google
> or the wikipedia for details....
>
> > Thanks for any hints, Torsten.
>
> Regards
> Juan Lucas





More information about the talk mailing list