MapTools.org

[maplab-users] Add Controls to GMapFactory Output??

Paul Spencer spencer@dmsolutions.ca
Sun, 07 Sep 2003 16:45:50 -0400
Peter,

this version of GMapFactory is not well suited to the type of 
customization you are attempting, but it is definitely possible.  I 
would start by editing ImagesYukonJ.phtml and adding something like:

<SELECT name="landsat" 
onchange="zoomtolandsat(this.options.[this.selectedindex].value">
<OPTION value="<geo-coords in form minx,miny;maxx,maxy>">name1</OPTION>
...
</SELECT>

and at the top of the page, in the head section:

<script language="JavaScript">
function zoomtolandsat( coords )
{
    document.forms[0].INPUT_COORD.value=coords;
    document.forms[0].INPUT_TYPE="landsat";
    document.forms[0].submit();
}
</script>

Now the tricky part, that requires some php.  You'll need to edit the 
file ImagesYukonJ.php and look for the function checkNavigation (on line 
319 in my version).

You can add a custom handler for your zoom to coords here with something 
like:

//my custom landsat image extents handler
case "landsat":
    //oMapNavigator is an instance of MapNavigator from the php
    //wrappers.  It has a reference to the MapSession (also from wrappers)
    //which (finally) has a reference to the PHP MapScript object.
    $oMap = $oMapNavigator->oSession->oMap;
    //we can now call any php mapscript functions here.
    //Assume that $szInputCoords is in format minx,miny;maxx,maxy
    //and that adMin and adMax now contain the geographic extents to zoom to
    $oMap->setextent( $adMin[0], $adMin[1], $adMax[0], $adMax[1] );
    break;

Finally, you will probably want to place this input box somewhere else 
on the page.  If you do, you will have to edit the file 
ImagesYukonJ_contents.php and put your select input somewhere in here.  
This is a little more straight forward, you should be able to figure it 
out, but be warned that if you open your project in GMapFactory again, 
this file will be overwritten and your changes lost.

Peter.VonGaza wrote:

>Howdy,  I'm relatively new to Mapserver and Maplab.  I've created a Maplab
>test page that works fine, but what i need to do is add a list box to the
>GMapFactory output to select an image.  Not being familiar with PHP
>programming i was hoping someone could give me a hint on how to do this.  I
>have 30+ ECW Landsat 7 scenes that i want to put in this list box.  When the
>user selects an image i would like to move the map to the centre of the
>selected image.  The following is a link to the java enabled test page:
> 
>http://imagserv.gov.yk.ca/projects/gmf_apps/ImagesYukonJ/ImagesYukonJ.phtml
><http://imagserv.gov.yk.ca/projects/gmf_apps/ImagesYukonJ/ImagesYukonJ.phtml
>  
>
> 
>Any comments highly appreciated!
> 
>Mapserver 4.0 + MapLab 2.0 + Apache 2 + PHP4 + Win2k
> 
>Peter von Gaza
>Geomatics Yukon
>mailto:petervongaza@gov.yk.ca <mailto:petervongaza@gov.yk.ca> 
>867-633-7998
> 
>
>  
>

-- 
--
Paul Spencer
Applications and Software Development
DM Solutions Group Inc.
http://www.dmsolutions.ca




This archive was generated by Pipermail.