Two Keymaps??
Paul Spencer
pspencer at DMSOLUTIONS.CA
Tue Aug 30 06:35:38 PDT 2005
Jennifer,
you can't do this with stock MapServer as the mapfile structure will not
permit it.
With some mapscript intervention, you can replace the image in the
reference object. I would probably approach it differently in
Chameleon, but a simple solution would be to have metadata at the map
object that contains sufficient information to replace the reference map
image.
I think you will need to know the following:
1. image
2. extents of the image
3. extents/scale to start using the image
One of the problems that I percieve with this approach is that the
purpose of having a second keymap would be to provide more detail when
you zoom in. If you have one (or possibly many) pregenerated images
then it will be possible for the user to zoom to an area that doesn't
make sense for the keymap you have generated.
You could make it extent-sensitive and divide up the 'zoomed in' keymaps :
+----+----+
| | |
+----+----+
| | |
+----+----+
but then it would be possible to zoom in at the center of this and get
poor results.
An alternate approach would be to use a second map file to define how to
draw a keymap image and have it render keymap images on the fly
depending on scale. This would be my preferred approach. You would set
scale thresholds for producing new keymaps and when they change, they
would always start at the center of where the user is currently viewing.
In Chameleon, I would add this as attributes of the keymap widgets to
abstract it away from the mapfile structure, perhaps using subtags:
<cwc2 type="KeymapDHTML" ... >
<ReferenceMap mapfile="path.to.mapfile" maxscale="100000000"/>
<ReferenceMap mapfile="path.to.mapfile" maxscale="10000000"/>
<ReferenceMap mapfile="path.to.mapfile" maxscale="1000000"/>
<ReferenceMap mapfile="path.to.mapfile" maxscale="100000"/>
</cwc2>
The widget would then have to track scale changes as the user zooms and
pans, refreshing the keymap image each time the user moves outside the
current extents of the keymap or changes scale across a threshold.
If you decide to attempt this, lemme know and I may have some time to
help out as I think this would be a great improvement.
Cheers
Paul
Jennifer Zeisloft wrote:
> Hello All-
>
> I am playing with including two keymaps in my application (one that is
> more useful when zoomed in, and one when zoomed out). They would be
> displayed simultaneously. I am having some trouble doing this, though
> it doesn't seem like it should be too tough.
>
> I am also using Chameleon (the Keymap DHTML widget). However, I think
> my first task towards accomplishing this would be on the MapServer end.
> When I place a second Reference object in the mapfile, I receive the
> error that there is a dupilcate item:
>
>
> *Warning*: [MapServer Error]: getString(): Duplicate item (IMAGE):(line
> 49) in *C:\ms4w\apps\chameleon\htdocs\common\wrapper\map_session.php* on
> line *215*
>
> *Warning*: Failed to open map file
> C:\ms4w\apps\chameleon\lscmp\htdocs/../map/wlscmp.map in
> *C:\ms4w\apps\chameleon\htdocs\common\wrapper\map_session.php* on line *215*
>
> *Fatal error*: Call to a member function on a non-object in
> *C:\ms4w\apps\chameleon\htdocs\widgets\KeyMapDHTML\KeyMapDHTML.widget.php*
> on line *115
>
>
> *
> Might there be a simple solution? Or would I need to rewrite a bunch of
> code somewhere (if so, where?)? I would really appreciate any hints you
> can pass along. Thanks in advance for your help!
>
> Jennifer Zeisloft
> UW Sea Grant
--
+-----------------------------------------------------------------+
|Paul Spencer pspencer at dmsolutions.ca |
+-----------------------------------------------------------------+
|Applications & Software Development |
|DM Solutions Group Inc http://www.dmsolutions.ca/|
+-----------------------------------------------------------------+
More information about the MapServer-users
mailing list