Overlay images from WMS servers (web mapping servers) on map projections [message #47435] |
Wed, 08 February 2006 06:01  |
Jan Kristian Jensen
Messages: 10 Registered: February 2006
|
Junior Member |
|
|
I thought I had a brilliant idea of how to combine images from WMS
servers (OGC Web Mapping Services compliant servers) on map projections
using map_set or map_proj_init functions. The result is not by far good
enough - and I can't figure what's wrong.
First I use my favourite http client to send a OGC WMS getMap-request to
my favourite WMS server. Part of the URL is a boundingbox (BBox)
parameter containing coordinates for lower left and upper right corner,
and how many x-y pixels there should be. Further the projection must be
specified. An easy test case would be the equirectangular projection, or
EPSG:4623 in OGC speak.
Then the easiest thing would be to open a window with the exact same
size, call map_set with the appropriate projection and display the
image. Something like this:
--- Example - you have to provide the wms file yourself ... -
; Limit = boundingBox coordinates to WMS server
limit = [ 59.5, 3.5, 61.0, 5.2]
map_set, 0, 0, /cylindrical, xmargin = 0, ymargin = 0, limit = limit
wmsimage = read_png( filename, r, g, b)
tvlct, r, g, b
window, xsize = 1200, ysize = 1000
tv, wmsimage
; Add a nice grid
device, decomposed = 0
tek_color
map_Grid, latdel = 0.25, londel = 0.25, color = 2
-------------------------------
My wmsimage example displays the coast contour and a grid line for every
0.25 degree lat/lon. This to compare with the lines from map_grid. The
two set of grid lines are fairly close in the center of the image, but
off by up to 1.9 km at the egde of the image. It is _/*very*\_ apparent
that the wms image and the map_grid lines do not match at all exept for
a small area near the center of the image.
I may have misunderstand something about projections and/or how to set
them correctly: I think equirectangular = EPSG:4326 = cylindrical
projection with standard parallell at 0 degrees, which should be the
default projection for map_set.
The symmetry about the image center makes me suspect there is some
border issue here. If I don't use the xmargin or ymargin keywords (or
/noborder) I get an even larger error. I can thank this newsgroup for
figuring that out :)
I'm quite frustrated at the moment: The result of the above method is
NOT good enough. I can't bring my mind to accept that this method
shouldn't work - but it doesn't, and I can't figure out why....
I know you can use map_projection_init and map_projection forward to get
more fine granular control - but that really shouldn't be nescessary
with this feeble task!!! If so, Ben Tupper posted an example (Nov 15
2004) of how to do this with direct graphics. I may start there...
Cheers, Jan
--
Jan Kristian Jensen
Remove the obvious from the email adress to email me.
|
|
|