[ gpsdrive ] WMS and registering maps by bounding box

Hamish hamish_b at yahoo.com
Fri Oct 3 00:52:36 AKDT 2008


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?

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.


Hamish

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.  ?



      



More information about the GPSdrive mailing list