getElementsByTagName('configuration'); $params = $configuration->item(0)->getElementsByTagName('param'); for($i = 0; $i < $params->length; $i++) { $param = $params->item($i); if($param->getAttribute("name") == "projection") { $mapbook_projection = $param->firstChild->nodeValue; } } $epsg4326 = ms_newprojectionobj("+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs"); $epsg2913 = ms_newprojectionobj("+proj=lcc +lat_1=46 +lat_2=44.33333333333334 +lat_0=43.66666666666666 +lon_0=-120.5 +x_0=2500000.0001424 +y_0=0 +ellps=GRS80 +to_meter=0.3048 +no_defs"); $y = $_REQUEST['y']; $x = $_REQUEST['x']; $projection = $_REQUEST['projection']; if($projection == "DM") { $y = explode("-",$y); $x = explode("-",$x); $y = DMtoDEC($y[0],$y[1]); $x = DMtoDEC($x[0],$x[1]); $x = -$x; //Need to get this as a negative to get in west hemisphere } elseif($projection == "DMS") { $y = explode("-",$y); $x = explode("-",$x); $y = DMStoDEC($y[0],$y[1],$y[2]); $x = DMStoDEC($x[0],$x[1],$x[2]); $x = -$x; //Need to get this as a negative to get in west hemisphere } if(strlen($y) > 0 && strlen($x) > 0) { $xy = $x . "," . $y; if($projection != $mapbook_projection) { $pointWkt = "POINT(" . $x . " " . $y . ")"; $xy = transform($pointWkt,$epsg4326,$epsg2913); } $xy = explode(",",$xy); $js = sprintf('GeoMOOSE.zoomToPoint(%f,%f,%f);', $xy[0], $xy[1], 1000); $js .= sprintf('addMark(%f,%f);', $xy[0], $xy[1]); } header('Content-type: text/xml'); print ""; print ""; print ""; print ""; function transform($pointWkt,$projInObj,$projOutObj) { $point = ms_shapeObjFromWkt($pointWkt); $point->project($projInObj, $projOutObj); $pointWkt = $point->toWKT(); return $point->bounds->minx . "," . $point->bounds->miny; } function DMStoDEC($deg,$min,$sec) { return $deg+((($min*60)+($sec))/3600); } function DMtoDEC($deg,$min) { return $deg + ($min/60); } function DMtoDEC_GPS($dm) { $pointLoc = strrpos($dm, '.'); $degree = substr($dm,0,$pointLoc-2); $minute = substr($dm,$pointLoc-2); return $degree + ($minute/60); } ?>