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

Home » Public Forums » archive » Making a html image map?
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
Making a html image map? [message #79282] Wed, 15 February 2012 13:11 Go to next message
Matt Francis is currently offline  Matt Francis
Messages: 94
Registered: May 2010
Member
I am making maps of a regional instrument network, with colour coded
icons showing the status of each instrument. I'd like to be able to
create a web page where the icons could be clicked to go to a more
detailed page for the individual site. I'm playing around with using a
html image map to do this. Ideally the IDL code making the map would
also auto-generate the appropriate html. The problem I'm having is
getting the co-ordinates of the image map to match up with where I'm
putting the icons in the image.

Does anyone know of an elegant way of doing this, or can think of a
fundamentally different, but better solution?
Re: Making a html image map? [message #79337 is a reply to message #79282] Mon, 20 February 2012 19:09 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
On Feb 15, 4:11 pm, Matt Francis <mattjamesfran...@gmail.com> wrote:
> I am making maps of a regional instrument network, with colour coded
> icons showing the status of each instrument. I'd like to be able to
> create a web page where the icons could be clicked to go to a more
> detailed page for the individual site. I'm playing around with using a
> html image map to do this. Ideally the IDL code making the map would
> also auto-generate the appropriate html. The problem I'm having is
> getting the co-ordinates of the image map to match up with where I'm
> putting the icons in the image.
>
> Does anyone know of an elegant way of doing this, or can think of a
> fundamentally different, but better solution?

I use this little bit of code to make <AREA> statements for image maps
with circle areas. Be sure you set up the plot coordinates ahead of
time before calling the function.

This code uses the CIRCLE region, but modifying to make a different
region is trivial.

Craig

; COORD_TO_MAPAREA - convert data (X,Y) to a series of <AREA>
statements
; DATAX,DATAY - array, (X,Y) positions of regions in data coordinates
; SRCNAME - array, string caption for each region
; AREA_STRUCT - upon output, a structure of area information
; RETURNS: string array of <AREA> html statements
;
; PREREQUISITES: plot coordinates already set up so that
CONVERT_COORD() will work.
function coord_to_maparea, datax, datay, srcname, area_struct=maparea
;; Find the X/Y pixel positions of each source. Do it now since the
;; coordinate system is in place
xysrc = convert_coord(datax, datay, /data, /to_device)
caption = strtrim(srcname,2)
maparea = {href:'', alt:'', title: '', xcent:0L, ycent: 0L, radius:
8L}
maparea = replicate(maparea, n_elements(srcname))
maparea.href = '"@=HTMLDIR=@'+repstr(strtrim(srcname,2), ' ', '_')
+'.html"'
maparea.alt = '"'+caption+'"' & maparea.title = maparea.alt
maparea.xcent = (xysrc(0,*))(*)
maparea.ycent = !d.y_vsize - (xysrc(1,*))(*)
maparea_html = string(maparea, $
format=("('<AREA HREF=',A0,' ALT=',A0,'
TITLE=',A0,"+$
"' SHAPE=CIRCLE
COORDS=""',I0,',',I0,',',I0,'"">')"))
return, maparea_html
end
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: read a C written binary file with IDL
Next Topic: tracking clusters through multiple timesteps

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

Current Time: Fri Oct 10 11:58:04 PDT 2025

Total time taken to generate the page: 8.62248 seconds