[ gpsdrive ] WMS and registering maps by bounding box

Guenther Meyer d.s.e at sordidmusic.com
Fri Oct 3 03:06:50 AKDT 2008


Am Freitag 03 Oktober 2008 schrieb Hamish:
> Guenther wrote:
> > gpsfetchmap.pl just requests a 1280x1024 jpg image with given bbox.
> > no magic, the request looks like that:
> > http://onearth.jpl.nasa.gov/wms.cgi?request=GetMap&width=1280&height=1024
> >&layers=global_mosaic&styles=&srs=EPSG:4326&format=image/jpeg&bbox=9.21027
> >,49.11960,9.27427,49.15160
>
> one thing I am trying to understand -- how to ensure that the given
> bounding box in the URL will create an image with equal north-south and
> east-west resolution?
>
the values are calculated. I don't know who did this formulas and factors...

> e.g. if I modify the above URL to be much wider longitudinally but the same
> latitude band, the server still gives me a 1280x1024 image but it is
> badly stretched:
>
> URL0="http://onearth.jpl.nasa.gov/wms.cgi?request=GetMap&width=1280\
> &height=1024&layers=global_mosaic&styles=&srs=EPSG:4326\
> &format=image/geotiff&bbox=9.21027,49.11960,9.27427,49.15160"
>
> wget "$URL0" -O onearth0.tif
>
> gdalinfo onearth.tif
>   ...
>   Pixel Size = (0.000050000100600,-0.000031251460314)
>
> If we change the Western bbox coord to 9.0000 and download again we get:
>   Pixel Size = (0.000214273488382,-0.000031251460314)
>
> note the y-scaling is unchanged.
>
> "Pixel Size" is degrees/pixel which you multiply by
>  1852*60*2817.9... to get the (lat) GpsDrive scale factor ... ?
> maybe we have to calc scale factor for lat, then apply that to lon
> by multiplying with cos(lat) and recalculating the east,west coords
> to include in the WMS query?  (better would be to rewrite gpsdrive
> to allow x_scale != y_scale)
>
>
> Note the difference between opening the GeoTiff in an image viewer like
> `qiv` and in something that compensates for the bidirectional scaling
> like `qgis`.
>
>
>
> Upon closer look, the code to register maps by bounding box coords
> appears only partially written, and center lat/lon and scale are still
> needed there.
>
the code takes given center coords and scale, and calculates the bbox needed 
to get an 1280x1024 image in the projection used by gpsdrive.
I guess, this is not really the best way to go, but it seems to work.

I had a short look at gdal; is the following scenario possible?
gpsdrive uses internally only one exactly defined projection. gdal ist used to 
get th maps from different sources (it seeme, it can access map servers 
directly?), and changes them into the gpsdrive format (maybe tile based).

> ps- thanks for centering the compass! If I may ask one tiny bit more: can
> you add that same buffering amount to the bottom of it?
> Also I might extend your "is the preview box useful?" question to the
> compass.  ?
>
yes. but the best way to this, would be to pack or not to pack the widgets, 
which would require a restart of gpsdrive to apply the changes.



-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.gpsdrivers.org/pipermail/gpsdrive/attachments/20081003/6a450f40/attachment.bin>


More information about the GPSdrive mailing list