Portland Trails Leif Erikson

“;
exit;
}
$data = pg_fetch_array($stat);

/* Query to select Profile Info*/
$ProfileSql = “SELECT name, miles, contour
FROM portland_point_elev
WHERE name = ‘$tname’
ORDER BY miles”;

/*Execute the query using prepared statements which are supposed to prevent and SQL Injection attack*/
//Create a placeholder for the array that goes into the pg_execute statement
$paramsProfile = array();
//Prepare the query for execution
$ProfileStat = pg_prepare($connection,”,$ProfileSql);
//Execute the prepared Query
$ProfileStat = pg_execute($connection,”,$paramsProfile);
/*Get the number of rows returned in the query */
$ProfileRows = pg_numrows($ProfileStat);

/*Check to see if the query executed*/
if ($ProfileRows <= 0) { echo "We are currently updating the profile info for this trail.
“;
exit;
}

/* Query to select Max Profile Info*/
$ProfileMaxSql = “SELECT MAX(miles) AS miles, MAX(contour) AS contour
FROM portland_point_elev
WHERE name = ‘$tname’ “;

/*Execute the query using prepared statements which are supposed to prevent and SQL Injection attack*/
//Create a placeholder for the array that goes into the pg_execute statement
$paramsMaxProfile = array();
//Prepare the query for execution
$ProfileMaxStat = pg_prepare($connection,”,$ProfileMaxSql);
//Execute the prepared Query
$ProfileMaxStat = pg_execute($connection,”,$paramsMaxProfile);

$ProfileMaxData = pg_fetch_array($ProfileMaxStat, $i);
$ProfileMaxMiles=$ProfileMaxData[“miles”];
$ProfileMaxElev=(($ProfileMaxData[“contour”])+100);

/* Query to select Min Profile Info*/
$ProfileMinSql = “SELECT MIN(miles) AS miles, MIN(contour) AS contour
FROM portland_point_elev
WHERE name = ‘$tname’ “;

/*Execute the query using prepared statements which are supposed to prevent and SQL Injection attack*/
//Create a placeholder for the array that goes into the pg_execute statement
$paramsMinProfile = array();
//Prepare the query for execution
$ProfileMinStat = pg_prepare($connection,”,$ProfileMinSql);
//Execute the prepared Query
$ProfileMinStat = pg_execute($connection,”,$paramsMinProfile);

/*Set the Minimum bounds for the Profile*/
$ProfileMinData = pg_fetch_array($ProfileMinStat, $i);
$ProfileMinMiles=$ProfileMinData[“miles”];
$ProfileMinElev=(($ProfileMinData[“contour”])-100);

/*Set the Y scale for the Profile*/
$ProfileScale=($ProfileMaxElev-$ProfileMinElev)/5;

/*Query to get the extents of the the trail */
$extent_select = “SELECT ST_EXTENT(ST_Transform(the_geom,4326))
FROM portland_named_trails
WHERE name = ‘$tname’;”;

/*Execute the query using prepared statements which are supposed to prevent and SQL Injection attack*/
//Create a placeholder for the array that goes into the pg_execute statement
$paramsExtent = array();
//Prepare the query for execution
$extent_result = pg_prepare($connection,”,$extent_select);
//Execute the prepared Query
$extent_result = pg_execute($connection,”,$paramsExtent);
$extent_query = pg_fetch_row($extent_result,0);

/*Manipulate the extent string result into 4 variables*/
$extent_string = str_replace(” “,”,”,substr($extent_query[0],4,-1));
$extent_array = explode(“,”,$extent_string);
$minlon = (double)$extent_array[0];
$minlat = (double)$extent_array[1];
$maxlon = (double)$extent_array[2];
$maxlat = (double)$extent_array[3];

/*Calculate the Elevation Change*/
$elev_change = abs($data[“startelev”]-$data[“highpoint”]);

/*Calculate Trail Type and distance*/
$trail_type_var = $data[“trail_type”];
$distance_var = $data[“mlabel”];

/*Set Variable for mechanized travel*/
$bike_allow = $data[“bike”];

switch ($trail_type_var) {
case “loop”:
$trail_type= “Loop”;
$distance = $distance_var;
break;
case “one-way”:
$trail_type= “Point to Point”;
$distance = $distance_var;
break;
case “out-back”:
$trail_type= “Out & Back”;
$distance = $distance_var * 2;
break;
}

?>

  • Name:
  • Length: miles
  • Elevation Change: ft.
  • Trail Type:



Interactive Trail Map
Click the Full Screen button button in the upper right-hand corner of the map to make the map Full Screen. The yellow line highlights your selected trail.

[map style=”width: auto; height:400px; margin:20px 0px 20px 0px; border: 1px solid black;” z=13 kml=”http://trailweb.net/kml/portland_leif_erikson.kmz”]

Trail Profile
Distance in miles, Elevation in feet
$ProfileRows-1) {echo ‘,’;}
}

echo “&chds=”;

?>,&chco=74BF04&chm=B,93CA41,0,0,0&cht=lc&chxt=x,y&chxr=0,0,,1|1,,,&chxtc=1,-670″ alt=”trail profile” />

Directions to Trailhead:


_MG_9029

_MG_9073

_MG_9064

_MG_9030




Photos Courtesy Evan Lovely

Trail Details:‘;
include($TrailDetailFile);}
*/
pg_close($connection);
?>

3 thoughts on “Portland Trails Leif Erikson”

Leave a Reply

Your email address will not be published. Required fields are marked *