[Mapserver-users] how to use HTML Legends with Steve Lime's DHTML interface
Emilio Mayorga
emiliom at u.washington.edu
Thu Dec 11 20:06:26 PST 2003
Thanks, Steve. That's great to hear.
I don't have my trusty DHTML book with me, so I can't research this too
much right now. I'll do it this weekend (maybe). I want to see if
there's a way to create a new DOM node where the HTML can be brought in
from a URL (in this case, the dynamically generated CGI statement with
mode=legend), then inserted into a DIV via innerHTML, or something like
that.
Meanwhile, I experimented with an IFRAME. It's not ideal (iframes seem
inelegant, in principle!), but I got it to work. If you're curious, my
test site is here:
http://basin.ocean.washington.edu/mapserv/mapache/eng/main.html
It's a very rudimentary site at this point. I don't know how to use the
CBE library yet, unfortunately. I'd like to.
BTW, I took a quick look at cbs.sportsline.com. Without trying to
understand everything, it looks like it uses an IFRAME element, too.
Here are the relevant bits that I implemented:
** In the HTML page:
<iframe id="legendiframe" src="blank.html" width="150" height="200"
scrolling="auto" frameborder="0">
[text for browsers that don't support iframes.]
</iframe>
** Then I have this javascript code:
function postdraw() {
// update the legend
var getlegendiframe = document.getElementById('legendiframe');
getlegendiframe.src = MapServer + "?map=" + mapfile +
"&mode=legend&mapext=0+0+" + (ms.extent[2] - ms.extent[0]) + "+" +
(ms.extent[3] - ms.extent[1]) + "&mapsize=" + ms.width + "+" + ms.height;
}
I hope this is helpful to you. I might call it quits and settle with
this kludge, but I'd love to hear what you come up with.
-Emilio Mayorga
Central American Ecology & Environment
garrobo.org
Steve Lime wrote:
> Hi Emilio: I'm working on something similar. Just haven't had time to
> make progress. Basically I was thinking of a dLegend object. Like the
> dBox interface I would use an anchor image to place a DTHML layer
> containing (with scrollbars) on a page. The layer would contain exactly
> what you mention below, an HTML legend. There's a good example of such a
> control at cbs.sportsline.com, the scores at a glance tool. I want to
> implement it using the same library (CBE) as dBox uses.
>
> Bottom line, I have no solution for you, only an idea. If you make
> progress please let me know.
>
> Steve
>
> Stephen Lime
> Data & Applications Manager
>
> Minnesota DNR
> 500 Lafayette Road
> St. Paul, MN 55155
> 651-297-2937
>
>
>>>>Emilio Mayorga <emiliom at u.washington.edu> 12/11/2003 2:49:02 PM
>>>>
>
> I've implemented Steve Lime's DHTML interface with dBox (javascript
> rubber band). It's working great (thanks!).
>
> Now I'd like to add an HTML legend. I can get my map file to generate
> the HTML for the legend using a stand-alone CGI line; that seems to
> work
> fine. But I can't figure out how to use that line to insert the HTML
> into my web page.
>
> I know some DHTML/DOM/javascript. What I'd like to know is how to take
> the result of something like:
> http://mysite/cgi-bin/mapserv?map=/var/www/html/mymapfile.map&mode=legend
> and insert it into a web page, without using Frames.
>
> Thanks for your help. Cheers,
>
> -Emilio Mayorga
>
>
> _______________________________________________
> Mapserver-users mailing list
> Mapserver-users at lists.gis.umn.edu
> http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
More information about the MapServer-users
mailing list