comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Overlay images from WMS servers (web mapping servers) on map projections
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Overlay images from WMS servers (web mapping servers) on map projections [message #47422] Wed, 08 February 2006 14:34 Go to next message
Jan Kristian Jensen is currently offline  Jan Kristian Jensen
Messages: 10
Registered: February 2006
Junior Member
liamgumley@gmail.com wrote:
> Jan,
>
> I encourage you to pursue the MAP_PROJ_INIT solution

[ ... ]

> ; Configure direct graphics data coordinates to match map projection
> plot, map.uv_box[[0, 2]], map.uv_box[[1, 3]], position=[0.0, 0.0, 1.0,
> 1.0], $
> /nodata, /isotropic, xstyle=5, ystyle=5, /noerase

Thank you Liam, I have made some initial tests and this seems to work
pretty well. This is probably the way to go for a generic solution.


For my particular projection (EPSG:4326) an even simpler approach may be
used:

limit = [ 59.5, 3.5, 61.0, 5.2] ; BoundingBox of wms call

plot, [ limit[1], limit[3]], [ limit[0], limit[2]], $
position = [0.0, 0.0, 1.0,1.0], /nodata, xstyle=5, $
ystyle=5, /noerase

Using the isotropic keyword seems to be wrong when the image is not
rectangular (which it very well could be - at your WMS server, a new
image to your liking is only one getMap request away). Further, the x
and y axis will typically not have the same spacing - I don't know if
this also could be a problem. However, I recall some hints from this
group about using /isotropic to get more predictable results from
routines like plot.




Jan

(Still pretty annoyed of why the straightforward map_set solution didn't
work... )
--
Jan Kristian Jensen

Remove the obvious from the email adress to email me.
Re: Overlay images from WMS servers (web mapping servers) on map projections [message #47424 is a reply to message #47422] Wed, 08 February 2006 11:55 Go to previous messageGo to next message
Jan Kristian Jensen is currently offline  Jan Kristian Jensen
Messages: 10
Registered: February 2006
Junior Member
David Fanning wrote:
> Jan Kristian Jensen writes:

>> map_set, 0, 0, /cylindrical, xmargin = 0, ymargin = 0, limit = limit
>
>
> Whenever I've had to solve this problem, I use POSITION-[0,0,1,1]
> instead if the [XY]Margin keywords. I'd try that and see
> if it helps.

Nope - same problem as before. At least the /noborder, x/ymargin and
position seems to behave consistently (but maybe not the way I hope for)


Also, and probably more importantly, I would
> make sure your latcenter and loncenter are in the center
> of you limits. They aren't, currently.

I've played around with different values for p0Lat, p0Lon. Changing them
has no visible effect whatsoever - at least not at this scale. The
mismatch looks about the same.


From this group I understand that setting p0Lat, p0lon correctly often
is crucial, probably because many projection demands that you specify
some point of origin (central meridian or similar) for your map. This
particular projection demands that the central meridian is zero, hence
p0lat = 0.


The EPSG:4326 is probably the simplest projection available, and has
many names: Equidistant lat/lon grid, equirectangular, rectangular
projection, plane chart, plate carre, unprojected map, lat/lon grid...
More formally, epsg:4326 is a special case of a cylindrical projection,
defined by that the central meridian is zero.
http://mathworld.wolfram.com/EquirectangularProjection.html


According to the docs, this is the _*/default\*_ projection used by
map_set - and p0Lat, p0lon = 0 is the default value for these optional
parameters.


Jan

--
Jan Kristian Jensen

Remove the obvious from the email adress to email me.
Re: Overlay images from WMS servers (web mapping servers) on map projections [message #47425 is a reply to message #47424] Wed, 08 February 2006 11:01 Go to previous messageGo to next message
Jan Kristian Jensen is currently offline  Jan Kristian Jensen
Messages: 10
Registered: February 2006
Junior Member
kuyper@wizard.net wrote:
> Jan Kristian Jensen wrote:

[ ... ]

>> map_set, 0, 0, /cylindrical, xmargin = 0, ymargin = 0, limit = limit

[ ... ]


>> window, xsize = 1200, ysize = 1000

[ ... ]


> MAP_SET sets up a projection fitted to the current window, creating one
> with default settings if there isn't one already current. Therefore,
> you need to move your map_set call after your call to WINDOW, in order
> for the map projection to be appropriate.

You are absolutely right - and I'm sorry i messed up the order of these
two commands when posting.



Jan
--
Jan Kristian Jensen

Remove the obvious from the email adress to email me.
Re: Overlay images from WMS servers (web mapping servers) on map projections [message #47426 is a reply to message #47425] Wed, 08 February 2006 09:33 Go to previous messageGo to next message
James Kuyper is currently offline  James Kuyper
Messages: 425
Registered: March 2000
Senior Member
Jan Kristian Jensen wrote:
...
> ; 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

MAP_SET sets up a projection fitted to the current window, creating one
with default settings if there isn't one already current. Therefore,
you need to move your map_set call after your call to WINDOW, in order
for the map projection to be appropriate.
Re: Overlay images from WMS servers (web mapping servers) on map projections [message #47430 is a reply to message #47426] Wed, 08 February 2006 07:41 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
liamgumley@gmail.com writes:

> I encourage you to pursue the MAP_PROJ_INIT solution, since it is much
> more robust than MAP_SET. I'm not familiar with the projection you
> mention, but here is how I create a UTM projection to match up with a
> GeoTIFF image:
>
> ; Create graphics window
> window, /free, xsize=600, ysize=800
>
> ; Define map projection
> map = map_proj_init('UTM', limit=[10.15, -78.77, 29.87, -95.29],
> zone=16)
>
> ; Configure direct graphics data coordinates to match map projection
> plot, map.uv_box[[0, 2]], map.uv_box[[1, 3]], position=[0.0, 0.0, 1.0,
> 1.0], $
> /nodata, /isotropic, xstyle=5, ystyle=5, /noerase
>
> ;- Plot continent outlines
> map_continents, map=map

I'm not sure "robust" is the word I was using the other day,
Liam, when I tried to create a MAP_PROJ_INIT projection
*other* than this one for the GSHHS article I was writing.

I absolutely cannot figure out how this projection space works.
The documentation, as far as I can tell, is hopeless. I presume
you have to look elsewhere to figure out how it works. But
I haven't found the right place yet.

I wanted a map projection of the Great Lakes Region of the US,
positioned in the window according to a POSITION keyword. It
seems straightforward, but a couple of hours of work got me
exactly nowhere. :-(

Can you show me how you would do this robustly? :-)

Cheers,

David

P.S. I think the word I was using had four letters instead
of five. :-)
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: Overlay images from WMS servers (web mapping servers) on map projections [message #47432 is a reply to message #47430] Wed, 08 February 2006 07:31 Go to previous messageGo to next message
liamgumley is currently offline  liamgumley
Messages: 74
Registered: June 2005
Member
Jan,

I encourage you to pursue the MAP_PROJ_INIT solution, since it is much
more robust than MAP_SET. I'm not familiar with the projection you
mention, but here is how I create a UTM projection to match up with a
GeoTIFF image:

; Create graphics window
window, /free, xsize=600, ysize=800

; Define map projection
map = map_proj_init('UTM', limit=[10.15, -78.77, 29.87, -95.29],
zone=16)

; Configure direct graphics data coordinates to match map projection
plot, map.uv_box[[0, 2]], map.uv_box[[1, 3]], position=[0.0, 0.0, 1.0,
1.0], $
/nodata, /isotropic, xstyle=5, ystyle=5, /noerase

;- Plot continent outlines
map_continents, map=map

Cheers,
Liam.
Practical IDL Programming
http://www.gumley.com/
Re: Overlay images from WMS servers (web mapping servers) on map projections [message #47434 is a reply to message #47432] Wed, 08 February 2006 06:11 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Jan Kristian Jensen writes:

> 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

Whenever I've had to solve this problem, I use POSITION-[0,0,1,1]
instead if the [XY]Margin keywords. I'd try that and see
if it helps. Also, and probably more importantly, I would
make sure your latcenter and loncenter are in the center
of you limits. They aren't, currently.

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: Overlay images from WMS servers (web mapping servers) on map projections [message #47483 is a reply to message #47430] Fri, 10 February 2006 04:18 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

> I absolutely cannot figure out how this projection space works.
> The documentation, as far as I can tell, is hopeless. I presume
> you have to look elsewhere to figure out how it works. But
> I haven't found the right place yet.
>
> I wanted a map projection of the Great Lakes Region of the US,
> positioned in the window according to a POSITION keyword. It
> seems straightforward, but a couple of hours of work got me
> exactly nowhere. :-(
>
> Can you show me how you would do this robustly? :-)

Nothing!? No takers?

Humm. MAP_PROJ_INIT must be less robust than even I
imagined. :-)

Cheers,

David

P.S. How about pointers to a good map projection page?

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: IDLWAVE routine info problem
Next Topic: Scite for IDL.

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 20:03:03 PDT 2025

Total time taken to generate the page: 0.05037 seconds