NAD83. if( $datum == "wgs84" ) $datum = "nad83"; else if( $datum != "nad27" && $datum != "nad83" ) $datum = "nad27"; } // Map scale. if( isset( $_GET[ "s" ] ) ) { $s = (int) $_GET[ "s" ]; if( $s <= 25 ) $zoom = 4; else if( $s <= 50 ) $zoom = 8; else if( $s <= 100 ) $zoom = 16; else if( $s <= 200 ) $zoom = 32; else if( $s <= 400 ) $zoom = 64; else $zoom = 128; } // UTM coordinates. if( isset( $_GET[ "n" ] ) ) $utm_n = (int) $_GET[ "n" ]; if( isset( $_GET[ "e" ] ) ) $utm_e = (int) $_GET[ "e" ]; if( isset( $_GET[ "z" ] ) ) $utm_z = (int) $_GET[ "z" ]; // If UTM coordinates were specified, convert them to lat/lon. if( isset( $_GET[ "n" ] ) && isset( $_GET[ "e" ] ) && isset( $_GET[ "z" ] ) && $utm_z > 0 ) { // Initialize map projection types. $proj_utm = ms_newprojectionObj( "proj=utm,datum=" . strtoupper( $datum ) . ",zone=" . $utm_z ); $proj_latlon = ms_newprojectionObj( "proj=latlong,datum=" . strtoupper( $datum ) ); // Convert from UTM to lat/lon. $po_temp = ms_newpointObj(); $po_temp->setxy( $utm_e, $utm_n ); $po_temp->project( $proj_utm, $proj_latlon ); $lat = $po_temp->y; $lon = $po_temp->x; // print( "UTM reprojection.\n" ); // print( "Z: " . $utm_z . "
\n" ); // print( "N: " . $utm_n . "
\n" ); // print( "E: " . $utm_e . "
\n" ); // print( "Src: " . "proj=utm,datum=" . strtoupper( $datum ) . ",zone=" . $utm_z . "
\n" ); // print( "Dest: " . "proj=latlong,datum=" . strtoupper( $datum ) . "
\n" ); // print( "Lat: " . $lat . "
\n" ); // print( "Lon: " . $lon . "
\n" ); // print( "Z > 0: " . ( $utm_z > 0 ) . "
\n" ); // exit(); } // Correct non-negative longitudes. if( $lon > 0.0 ) $lon = -$lon; $url = sprintf( "/map.php?lat=%0.5f&lon=%0.5f&datum=%s&zoom=%d", $lat, $lon, $datum, $zoom ); header( "Location: " . $url ); exit(); ?>