[mapserver-users] Mapserver zoom box/query

ben wyss bmwyss at gmail.com
Tue Oct 28 10:23:23 PDT 2008


I am developing a mapserver internet map, and I have run into a problem with
the query tool. I would like the user to be able to query single features on
the map with a single click – this feature works fine. I would also like the
user to be able to query multiple features by pulling a selection box over
several features on the map. The only way I have been able to get this to
'work' is by piggy backing the query pull box on the zoom pull box. This
will return a query of the selected features from the map! The problem is
that when the user then refreshes the map, the map will then zoom to the
area that the query box was pull to. In the code below I am using 'Info' as
the call out for the query tool.

Any help here would be greatly appreciated, Thanks!



[CODE] function submit_form()

{       if(document.mapserv.zoom.value == "0")

{       // cy: document.mapserv.target = "query_iframe";

 // cy: document.mapserv.mode.value = "nquery";       }

else if(document.mapserv.zoom.value == "X")

{       document.mapserv.zoom.value = "1";

      document.mapserv.info.value = "0";

     document.mapserv.imgext.value = "-180 -90 180 90";

       document.mapserv.target = "_self";

       document.mapserv.mode.value = "browse";       }

 else {       document.mapserv.target = "_self";

      document.mapserv.mode.value = "browse";       }

       //alert(document.mapserv.zoom.value);       return;       }
function SucheForm() {       var tmp =

"('[NAME]'=~/" + document.mapserv2.suchen.value + "/)";

      document.mapserv2.qstring.value =

tmp.replace("Ü","U");

     //alert(document.mapserv2.qstring.value);       return;       }

                          function OpenWin(Info)

 {         }              function bClick(bName)

{

      document.Move.src = "/map_browser/graphics/B_Hand_g.jpg";

document.ZoomIn.src = "/map_browser/graphics

/B_ZoomIn.jpg";

document.ZoomOut.src = "/map_browser/graphics

/B_ZoomOut.jpg";

document.Info.src = "/map_browser/graphics/B_Info.jpg";

       dd.elements.moveLayer.hide();

     dd.elements.zoomLayer.hide();

        if (bName == "Move") {       document.mapserv.zoom.value = "1";

      document.mapserv.knopf.value = "Move";

      dd.elements.moveLayer.show();

      document.Move.src = "/map_browser/graphics

/B_Hand_s.jpg";       }

  if (bName == "ZoomIn")

{       document.mapserv.zoom.value = "2";

       document.mapserv.knopf.value = "ZoomIn";

       dd.elements.zoomLayer.show();

      document.ZoomIn.src = "/map_browser/graphics

/B_ZoomIn_s.jpg";       }

 if (bName == "ZoomOut")

{       document.mapserv.zoom.value = "-2";

      document.mapserv.knopf.value = "ZoomOut";

      document.ZoomOut.src = "/map_browser/graphics

/B_ZoomOut_s.jpg";       }



if (bName == "Info")

{       document.mapserv.zoom.value = "0";

      document.mapserv.knopf.value = "Info";

      dd.elements.infoLayer.show();

      document.Info.src = "/map_browser/graphics/B_Info_s.jpg";



[/CODE]



[CODE]#zoomLayer

{ position: absolute; z-index: 100; left: 0px; top: 230px; width:

 800px; height: 650px; padding: 0px; border: 0px solid black; color: black;
visibility: hidden; }

 #infoLayer { position: absolute; z-index: 100; left: 0px; top:

 230px; width: 800px; height: 650px; padding: 50px; border: 0px solid black;
color: black; visibility: hidden; }

[/CODE]



[CODE] <div id="zoomLayer">

 <img src="/map_browser/graphics/pix.gif" border="0" height="600"
width="800">

  </div>         <div id="infoLayer">

     <img src="/map_browser/graphics/pix.gif" border="0" height="600"
width="800">

  </div>

[/CODE]



[CODE]               <A HREF="javascript:void(0)"

onClick="bClick('ZoomIn')">

 <img name="ZoomIn" src="/map_browser/graphics

/B_ZoomIn.jpg" border="0"

                           alt="vergrössern" width="29" heigth="25">

                </A>

<A HREF="javascript:void(0)" onClick="bClick('ZoomOut')">

                  <img name="ZoomOut"
src="/map_browser/graphics/B_ZoomOut.jpg" border="0"

               alt="verkleinern" width="29" heigth="25">

                </A>

                            <input type="image" name="submit"
src="/map_browser/graphics/B_Schweiz.jpg"

                           alt="ganze Schweziz"
onClick="document.mapserv.zoom.value = 'X'">


 <A HREF="javascript:void(0)" onClick="bClick('Info')">

                  <img name="Info"  border="0" alt="Info
                  abfragen" width="29" heigth="25">

  </A> [/CODE]



[CODE]  if(dd.obj.name == "zoomLayer")

{     myXS = dd.e.x; //+karte.offsetLeft;

myYS = dd.e.y;            //+karte.offsetTop;     //alert("Start:
"+myXS+"/"+myYS);   }

 if(dd.obj.name == "infoLayer") {     myXS = dd.e.x; //+karte.offsetLeft;
myYS = dd.e.y;      //+karte.offsetTop;

//alert("Start: "+myXS+"/"+myYS);   } }

[/CODE]



[CODE]function my_DragFunc()

 {   if(dd.obj.name == "zoomLayer")

{     myXM = myXS + dd.obj.x - dd.obj.defx;

myYM = myYS + dd.obj.y - dd.obj.defy;

if(1==1) {     if (myXS <= myXM) {

marker.style.left = (myXS) + "px";

marker.style.width = (myXM-myXS) + "px";     }

 else {               marker.style.left = (myXM) + "px";
    marker.style.width
= (myXS-myXM) + "px";     }

 if (myYS < myYM) {

marker.style.top = (myYS) + "px";

marker.style.height = (myYM-myYS) + "px";     }

 else {               marker.style.top = (myYM) + "px";
   marker.style.height
= (myYS-myYM) + "px";     }       marker.style.display = "block";

return false;    }       }

 if(dd.obj.name == "infoLayer")

{     myXM = myXS + dd.obj.x - dd.obj.defx;      myYM = myYS + dd.obj.y -
dd.obj.defy;

 if(1==1) {     if (myXS <= myXM) {                marker.style.left =
(myXS) + "px";                    marker.style.width = (myXM-myXS) + "px";
}

else {                marker.style.left = (myXM) + "px";
    marker.style.width
= (myXS-myXM) + "px";     }

 if (myYS < myYM) {               marker.style.top = (myYS) + "px";
marker.style.height = (myYM-myYS) + "px";

 }

else {                marker.style.top = (myYM) + "px";
   marker.style.height
= (myYS-myYM) + "px";     }       marker.style.display = "block";     return
false;    }       } } [/CODE]



[CODE]

 if(dd.obj.name == "infoLayer")

{     myXE = myXS + dd.obj.x - dd.obj.defx - 0;          //karte.offsetLeft;


 myYE = myYS + dd.obj.y - dd.obj.defy - 211;           //karte.offsetTop;


 myXS = myXS - 0;     //karte.offsetLeft;     myYS = myYS - 211;
//karte.offsetTop;

 //alert("Start: "+myXS+"/"+myYS+" End: "+myXE+"/"+myYE);

[/CODE]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20081028/cccb0579/attachment.htm>


More information about the MapServer-users mailing list