MapTools.org

[maplab-users] Patch to add URL params

Paul Spencer pgs@magma.ca
Sat, 07 Sep 2002 12:37:40 -0400
Steven, I'll take a look at this and let you know if we include it or 
not.  We are going to be doing a major overhaul of gmapfactory and 
mapbrowser shortly, so it would happen as part of that work I suspect.

Cheers,

Paul

woodbri@swoodbridge.com wrote:
> Hi all,
> 
> I patched wrapper/map_navigator.php and app_name.php so you can enter 
> X=long&Y=lat and it will recenter the map on that lat,long this is 
> useful if you want another app to position the map or if you are 
> trying to locate an item in a shapefile by it's location. It should 
> probably be enhanced to optionally pass a DW=width so you can set the 
> width to control the zoom if  needed.
> 
> If your interested in that I can add it and send another diff.
> 
> It would be great if you guys would look this over and add it to 
> maplab.
> 
> Thanks,
>   -Steve W.
> 
> 
> 
> ------------------------------------------------------------------------
> 
> diff -Naur old/map_navigator.php new/map_navigator.php
> --- old/map_navigator.php	Sat Sep  7 00:31:41 2002
> +++ new/map_navigator.php	Fri Sep  6 14:47:31 2002
> @@ -573,7 +573,36 @@
>      // end recentre function
>      }      
>  
> +    /**
> +     * This function modifies the extents to cause a recentering on the
> +     * requested X, Y co-ordinates.
> +     *
> +     * @parm dX double - The X map co-ordinate to recenter to.
> +     * @parm dY double - The Y map co-ordinate to recenter to.
> +     */
> +    function goto( $dX, $dY )
> +    {
> +        // log entry
> +        $this->logFuncStart( LOG_VERBOSE, "goto() starting" );
> +
> +        // get current map extents
> +        $dMapMinX = $this->oSession->oMap->extent->minx;
> +        $dMapMinY = $this->oSession->oMap->extent->miny;
> +        $dMapMaxX = $this->oSession->oMap->extent->maxx;
> +        $dMapMaxY = $this->oSession->oMap->extent->maxy;
> +
> +        // reset extents to be centered on X,Y
> +        $dDX = ($dMapMaxX - $dMapMinX) / 2.0;
> +        $dDY = ($dMapMaxY - $dMapMinY) / 2.0;
> +        $this->oSession->oMap->setextent( $dX-$dDX, $dY-$dDY, $dX+$dDX, $dY+$dDY );
> +
> +        // log exit
> +        $this->logFuncEnd( LOG_ALL, "goto() done" );
> +
> +    // end goto function
> +    }
> +
>  // end MapNavigator class    
>  }
>  
> -?>
> \ No newline at end of file
> +?>
> diff -Naur old/vmap0.php new/vmap0.php
> --- old/vmap0.php	Sat Sep  7 00:31:19 2002
> +++ new/vmap0.php	Fri Sep  6 14:47:15 2002
> @@ -178,12 +178,23 @@
>      
>  }
>  
> +//check for X,Y goto parameters
> +if ( strlen( trim( $http_form_vars["X"] ) ) > 0 &&
> +     strlen( trim( $http_form_vars["Y"] ) ) > 0 )
> +{
> +    $http_form_vars["ROSA_CMD"] = "GOTO";
> +    $http_form_vars["INPUT_COORD"] = $http_form_vars["X"] . ";" .
> +                                     $http_form_vars["Y"];
> +
> +}
> +
>  // process navigation requests
>  if ( ( ( $http_form_vars['RosaMode'] != 1 &&
>         isset( $http_form_vars[ "mainmap_x" ] ) ) ||
>         ($http_form_vars['RosaMode'] == 1 ) &&
>         $http_form_vars["INPUT_COORD"] != "" &&
> -       isset( $http_form_vars["INPUT_COORD"] ) ))
> +       isset( $http_form_vars["INPUT_COORD"] ) ) ||
> +       $http_form_vars["ROSA_CMD"] == "GOTO" )
>  {
>      // check the naviagtion command and process
>      $xNavigate = checkNavigation($oMapNavigator,$http_form_vars["ROSA_CMD"],
> @@ -332,6 +343,13 @@
>          // check individual command
>          switch ($szRosaCmd)
>          {
> +        // goto
> +        case "GOTO":
> +            list($dX, $dY) = explode( ";", $szInputCoords );
> +            $oMapNavigator->goto( $dX, $dY );
> +            return true;
> +            break;
> +
>          // zoom in
>          case "ZOOM_IN":
>              //check if for point click


-- 
Paul Spencer
Applications and Software Development
DM Solutions Group



This archive was generated by Pipermail.