[OSM-talk] gdalwarp question

Torsten Mohr tmohr at s.netic.de
Sun May 3 23:39:45 BST 2009


Awesome!  Congratulations, i envy you.

I did not want to mislead people, maybe a misunderstanding?

I wrote in my mail that my understanding did not lead to a
correct image, i meant that somewhere there must be a
failure in my misunderstanding.
I did not want to say that gdalwarp does not work, it obviously
does work.


Has anybody got a hint on which of my assumptions is wrong?
a. The source SRS is epsg:4362
b. The target SRS should be as in osm.xml
c. Mapnik can not warp a raster image, it has to be pre-warped.
d. The "world file" of my TIF file is incorrect.
e. anything else?

I just tried the other hint of skipping the regions around the poles,
the height is 21600, which is +90.0 to -90.0.
I tried to go from +85.051128 to -85.051128 (atan(sinh(pi)) as
this was mentioned to be the limit of mercaator.
So i skipped 593 pixels at top and at bottom and changed the
world file for a strip generated like that:
0.00833507730103945403
0.00
0.00
-0.00833507730103945403
0.0
85.051128779806589

No success...

I began to reproject the blue marble with an own script but
there is a slight offset / scale yet.


Thanks for any hints,
Torsten.


> Please do not mislead people. gdalwarp works fine:
>
> http://tinyurl.com/germany-blue-marble
>
> Regards
> Juan Lucas
>
>
>
>
>
> ________________________________
>
>
>
>
> 		Hello Jukka,
>
> 		thanks for your hint, but to my understanding this contradicts
> 		the description of RasterImage in Mapnik and the web page
> 		that converts "blue marble" using gdalwarp.
>
> 		In the documentation for RasterImage it says that Mapnik
> 		can't (yet) reproject reaster image data, they have to match
> 		the target projection.  I got that answer to another question:
>
> 		http://www.mail-archive.com/mapnik-users@lists.berlios.de/msg01213.html
>
>
> 		So if in osm.xml there is:
>
> 		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"
>
> 		Then i think this should be the target projection (if i want to mix a
> raster image into it).
>
>
> 		The "blue marble" has lat / lon directly mapped to x / y coordinates.
> 		To my understanding this is similar to WGS84, to add the scaling
> 		with a "world file" makes sense to me.
>
> 		Looking at this page  i see a description of projections and the use of
> 		gdalwarp that describes how to get
>
> 		http://egb13.net/2009/04/bending-the-earth-gdalwarp-and-the-blue-marble/
>
>
> 		But in the end, my understanding did not leave to a correctly projected
> 		image...
>
>
> 		Best regards,
> 		Torsten.
>
> 		Am Sonntag, 3. Mai 2009 14:11:06 schrieb Jukka Rahkonen:
> 		> Torsten Mohr <tmohr <at> s.netic.de> writes:
> 		> > Hello,
> 		> >
> 		> > thanks for that hint.
> 		> >
> 		> > Right, the chosen projection won't work around the poles, i don't
> 		> > expect that.  In the call to gdalwarp i gave the source projection
> 		> > (EPSG:4326 or WGS84) and as target projection i gave the projection
> 		> > used in osm.xml.
> 		>
> 		> Hi,
> 		>
> 		> Your target projection is the so called Google projection, or
> 		> epsg:900913, or nowadays officially epsg:3785.  It is the projection
> 		> used in OSM slippy map, but the native OSM data are in epsg:4326. 
> 		> Therefore you should warp the downloaded images _into_ epsg:4326, not
> 		> from that.  Unfortunately I cannot say what would be the correct source
> 		> projection definition for your original images.
> 		>
> 		> An easy way to test your warped images is to download some OSM data in
> 		> shapefile format and in epsg:4326 projection from Geofabrik.de, open
> 		> the warped image with some GIS program like QGis or OpenJUMP together
> 		> with OSM shapefile and see if they suit well together.
> 		>
> 		> Gdalwarp options are documented at http://gdal.org/gdalwarp.html but
> 		> some further reading may be necesssary to understand what all the
> 		> options mean.
> 		>
> 		> -Jukka Rahkonen-
> 		>
> 		>
> 		>
> 		> _______________________________________________
> 		> talk mailing list
> 		> talk at openstreetmap.org
> 		> http://lists.openstreetmap.org/listinfo/talk
>
> 		_______________________________________________
> 		talk mailing list
> 		talk at openstreetmap.org
> 		http://lists.openstreetmap.org/listinfo/talk





More information about the talk mailing list