FW: simple question that the answers eludes my logic

Dan Dansereau ddansereau at HYDROPOINT.COM
Mon Oct 9 17:27:11 PDT 2006


Hello ALL

I have a need to have a small map file ( at the bottom of this email )

and a CGI driver - based on the Itasca Demo - it works for me,

and do to the total amount of other processes and scripts that make 

use if this technique - a rewrite to another form such as PHP or JAVA

is currently out of the question. 

 

I would like to have the map file get the raster image name at run time

And not fixed with "Jan" like the below map file segment. I'm not sure
where

or how to put this in the HTML. Currently the HTML gets then names from
a 

pre-defined pull down menu. The new names need to be similar to
Jan_01_2006

but can be anything legal date range.

......

LAYER

  NAME Jan_Earth

  TYPE RASTER

  STATUS ON

  TILEINDEX "Jan_index.shp"

  TILEITEM "Location"

  CLASS

    NAME 'Jan_Earth'

    keyimage data/JanKey.png

  END

END

....

 

I have tried several different ways as per the documentation to insert
this into the html and the map file

but with no success.

 

Would anybody have a mapfile and a CGI example that would be somewhat
compatible that they would be willing to share - or be able to point me
towards some additional documentation...

 

My thanks ahead of time...

Dan

 

This is the map file

# start of maps file

MAP

NAME WORLD

STATUS ON

SIZE 600 600

EXTENT -180.0 -90.0 180.0 90.0

UNITS dd

SHAPEPATH "data"

IMAGECOLOR 255 255 255

TEMPLATEPATTERN "world"

IMAGETYPE PNG

 

SYMBOL

  NAME 'circle'

  TYPE ELLIPSE

  POINTS 1 1 END

  FILLED TRUE

END

......took a bunch out here due to the 80k email limits

#

# Start of layer definitions

#

# raster data 1st

# World Images by Month

LAYER

  NAME Jan_Earth

  TYPE RASTER

  STATUS ON

  TILEINDEX "Jan_index.shp"

  TILEITEM "Location"

  CLASS

    NAME 'Jan_Earth'

    keyimage data/JanKey.png

  END

END

LAYER

  NAME Feb_Earth

  TYPE RASTER

  STATUS ON

  TILEINDEX "Feb_index.shp"

  TILEITEM "Location"

  CLASS

    NAME 'Feb_Earth'

    keyimage data/FebKey.png

  END

END

 

#

# then the rest of the maps

#

LAYER

  CONNECTIONTYPE postgis

  CONNECTION "user=dad dbname=maps host=10.0.0.215"

  NAME wld_country

  TYPE POLYGON

  DATA "the_geom from wld_country"

  STATUS on

  TRANSPARENCY 50

  CLASS

    NAME 'wld_country'

    OUTLINECOLOR 1 1 1

  END

END

.........took a bunch out here due to the 80k email limit

 

END # Map File 

This is the html file

<html>

<head>

<meta http-equiv="Content-Language" content="en-us">

<title>MapServer/Imaps</title>

<! all code and source from the mapserver examples and documentation ->

 

<!-- the DHTML JavaScript library includes -->

<script language="javascript" src="javascript/cbe/cbe_core.js"></script>

<script language="javascript"
src="javascript/cbe/cbe_event.js"></script>

 

<!-- MapServer specific JavaScript library includes -->

<script language="javascript" src="javascript/mapserv.js"></script>

<script language="Javascript" src="javascript/dbox.js"></script>

 

<!-- utility library -->

<script language="JavaScript" src="javascript/utils.js"></script>

 

<!-- scripting specific to the application -->

<script language="javascript">

  // first, nab any arguments passed to this page (so we don't have to
edit the page)

  var args = getargs();

 

  // the DHTML main mapping window

  var main = new dBox("main", 600, 600, "#FF0000", 2);

  // main.verbose = true;

 

  // the DHTML reference map window

  var reference = new dBox("reference", 120, 120, "#989898", 1);

  reference.box = false;

  reference.cursorsize = 0;

 

  // mapserv.js global variables

  var MapServer = args.program;

  var QueryServer = MapServer;

  var Interface = "dhtml";

 

  // create the Mapserv object

  var ms = new Mapserv("main", args.map, -180.0, -90.0, 180.0, 90.0,
600, 600);

  // layer definitions

 

  ms.layers[ms.layers.length] = new Layer('wld_country', 'wld_country',
'layers', true, null, null);

  ms.layers[ms.layers.length] = new Layer('Jan_Earth', 'Jan_Earth',
'layers', false, null, null);

  ms.layers[ms.layers.length] = new Layer('Feb_Earth', 'Feb_Earth',
'layers', false, null, null);

......took a bunch out here due to the 80k email limits

  ms.layers[ms.layers.length] = new Layer('wld_states', 'wld_states',
'layers', false, null, null);

......took a bunch out here due to the 80k email limits

  ms.layers[ms.layers.length] = new Layer('stations', 'stations',
'layers', false, null, null);

  ms.buildlayers();

 

  // add the reference map

  ms.referencemap = new Mapserv("reference", args.map, -180.0, -90.0,
180.0, 90.0, 180, 180);

 

  //

  // Extensions to Mapserv.draw(): this allows you to exend the
capabilties of

  // of the default draw method. There are post and pre draw functions
available.

  //

  function predraw() {

    // clear any query results

    top.query_frame.location.href='blank.html';

 

....took a bunch out here due to the 80k email limits

....this is most of the standard java pan/zoom/scalebar stuff

 

  // various event handlers called by jBox/dBox

  function mousemove_handler(name, x, y) {

    window.status = "Coordinates: x=" + Math.round(Number(ms.extent[0] +
x*ms.cellsize)) + " and y=" + Math.round(Number(ms.extent[3] -
y*ms.cellsize));

  }

  function mouseexit_handler(name) { window.status = ""; }

  function mouseenter_handler(name) { window.status = ""; }

 

  // page initialization function

  function windowOnload() {

    main.initialize();

    reference.initialize();

    ms.zoomdir=1;

    ms.draw();

  }

 

  // zoom to full extent function

  function ZoomExtent() {

    main.initialize();

    reference.initialize();

 

    ms.zoomdir=1;

    ms.draw();

  }

 

</script>

 

</head>

<body bgcolor=#FFFFFF onResize="main.sync();reference.sync()">

 

<center>

<table border=0 cellspacing=0 cellpadding=4>

<tr>

<td valign="top" align=center>

  <div align="center">

  <table width="390" border="0" cellspacing="0" cellpadding="0"
bgcolor="#000080">

    <tr>

      <td align="right" width="18"><a
href="javascript:ms.pan('nw')"><img src="graphics/nw.gif" width="18"
height="18" border="0" alt="pan northwest"></a></td>

...took a bunch out here due to the 80k email limits

...this was the pan and map html stuff....

<td valign="top" bgcolor=#ffffff>

  <table cellpadding="1" cellspacing="0" border="0" bgcolor="#ffffff">

    <tr><td>

    <form name="mapserv" action="javascript:void(0)">

       <img border="0" src="wtcc.png" width="195" height="58"><br>

                <hr color="#3399FF">

        <b> World Base Map </b>

                <br>

                <b> Choose an Action: </b><br>

        <input onClick="ms.mode='map'" type="radio" name="mode" checked>
Browse Map<br>

        <input onClick="ms.mode='nquery'" type="radio" name="mode">
Query Features

        <br>

        <hr color="#3399FF">

        <b>Select Map Layers to Display </b><br>

        <select multiple name="layers" size=4
onChange="ms.togglelayers(this)">

          <option value="Jan_Earth" >Jan Earth Image

          <option value="Feb_Earth" >Feb Earth Image

...took a bunch out here due to the 80k email limits

         <option value="wld_country" selected > Country Boundaries

...took a bunch out here due to the 80k email limits

         </option>

        </select><br>

        <input type="button" value="Refresh Map" onClick="ms.draw()">

        <input type="button" value="Zoom Full" onClick="ZoomExtent()">

        <hr color="#3399FF">

        <b>Zoom Controls - Select & Click on Map</b><br>

        Zoom In <input onClick="ms.zoomdir=1" type=radio name=zoomdir >

        Pan <input onClick="ms.zoomdir=0" type=radio name=zoomdir
checked>

        Zoom Out <input onClick="ms.zoomdir=-1" type=radio name=zoomdir>

        <br>

        <font size="1">Zoom in by drawing a "rubber band" box (left
button on

                the mouse)</font>

        <hr color="#3399FF">

      </form>

 

      <b>Legend:</b><br>

      <img name="legend" src="graphics/red_pixel.gif">

      <br>

      <!-- this is the holding spot (the anchor) for the reference map
-->

      <DIV id="reference_anchor" style="position:relative;
visibility:visible; width:100%; height:100%; left:0px; top:0px;">

      <img src="graphics/red_pixel.gif" height="180" width="180"></DIV>

      <!-- absolutely positioned layer to hold the reference map -->

      <DIV id="reference" style="position:absolute; visibility:visible;
width:100%; height:100%; clip:rect(100%,100%,100%,100%);
background:transparent;">

      <IMG name="reference" src="data/world.png" height="180"
width="180"></DIV>

 

    </td></tr></table>

 

  </td></tr>

</table>

</center>

<p>

<a href="javascript:top.location.href='wx_map1.html'">Return to Weather
Station & Interactive Selection</a> from

<script language="javascript">

  document.write("<b>" + args.map_web_template + "</b>");

</script>

</body></html>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20061009/e4f07e4a/attachment.htm>


More information about the MapServer-users mailing list