DBox PHP Problems
Rob McCulley
maps98 at TELUSPLANET.NET
Fri Jun 17 11:18:02 PDT 2005
I would like to use DBox with PHP-mpscript, but I'm having some problems
figureing out how to implement it. I currently have it set up like so:
--- A bunch of PHP that sets up map size and layers ---
<!-- Step 1: dBox library include -->
<script language="JavaScript" src="javascript/dbox.js"></script>
<!-- Step 2: DHTML library includes -->
<script language="JavaScript"
src="javascript/cross-browser.com/x/x_core.js"></script>
<script language="JavaScript"
src="javascript/cross-browser.com/x/x_event.js"></script>
<script language="JavaScript"
src="javascript/cross-browser.com/x/x_dom.js"></script>
<script language="JavaScript"
src="javascript/cross-browser.com/x/x_drag.js"></script>
<script language="JavaScript" src="javascript/jsgraphics.js"></script>
<SCRIPT LANGUAGE="JavaScript">
// Step 3: Create the dBox object (initialize a few things)
var main_map = new dBox("main_map", <?php echo $map_height; ?>,
<?php echo $map_width; ?>, "#FF0000", 2);
main_map.box = true;
function setbox_handler(name, minx, miny, maxx, maxy) {
document.map_app.imgbox.value = minx + " " + miny + " " + maxx
+ " " + maxy;
document.map_app.imgxy.value = minx + " " + miny;
document.map_app.submit();
}
function seterror_handler(message) {
alert(message);
}
function reset_handler(name, minx, miny, maxx, maxy) { }
function startup() {
// Step 4: Initialize the dBox object
main_map.initialize();
}
</SCRIPT>
--- A bunch of PHP that generates the map and legend ---
<!--Display the Map -->
<!-- this is the holding spot (the anchor) for the map -->
<DIV id="main_map_anchor" style="position:relative;
visibility:visible; width:100%; height:100%; left:0px; top:0px;">
<IMG src="pixel.gif" height="<?php echo $map_height; ?>"
width="<?php echo $map_width; ?>">
</DIV>
<!-- absolutely positioned layer to hold the map -->
<DIV id="main_map" style="position:absolute; visibility:visible;
width:100%; height:100%; clip:rect(100%,100%,100%,100%);
background:transparent;">
<IMG name="main_map" src="<?php echo $image_url; ?>"
height="<?php echo $map_height; ?>" width="<?php echo $map_width; ?>">
</DIV>
My zoom tools are setup like so:
<input type=radio name=zoomdir value=1
onClick="main_map.boxon();">Zoom In<BR>
<input type=radio name=zoomdir value=0
onClick="main_map.boxoff();">Pan<BR>
<input type=radio name=zoomdir value=-1
onClick="main_map.boxoff();">Zoom Out<BR>
Two problems - the first is that the map isn't visible. I'm assuming it has
to do with the div boxes and the transparent pixels. Not my main problem,
I'm sure I can solve it. The main problem is that when I click on the zoom
in radio button (or any of the three radio buttons for that matter) I get a
javascript error "Object doesn't support property or method" pointing at the
line of code for the radio button.
Any ideas what I'm doing wrong? Or does anyone have an example of DBox
working with PHP that they can point me at?
Thank You,
Rob McCulley
GIS Coordinator
County of Vermilion River No. 24
(780) 846-2244
RMcCulley at County24.com
More information about the MapServer-users
mailing list