Archive for the ‘Bike routes’ Category

Nine Hills vista, Alamaden Quicksilver Bike Trail

July 6, 2009

Another bike route to top of St. Joseph Hill

May 26, 2009

At 6:30 AM this morning, our bike club tried yet another route to the summit of St. Joseph Hill in Los Gatos. The 6.44 miles ride took one hour and 10 minutes.

3 hour bike ride in Los Gatos

May 23, 2009

This morning at 6:30 AM Jim and I went for a bike ride that started in Los Gatos, over Kennedy, to Hicks, to Quicksliver park, back to Hicks, then Shannon, and finally back to Los Gatos, The ride took over 3 hours. Here is the route.

Hicks Road Bike Trail

December 15, 2007

This morning Bennett and I went for an early morning ride on Kennedy to Hicks and came back on Shannon. Here is the route. The roads were for most part free of car traffic. I guess everyone is busy doing their Christmas shopping at the super malls away from town. At the top of Shannon we saw a group of riders amongst them was our friend K.L. Seh.

Los Gatos/Sheldon Road “Billy Goat” Route

November 25, 2007

Sheldon RouteThis morning Tom introduced me to the Sheldon Road/Trail bike route. It is uphill alright — none stop climb. We started at a elevation of less than 200 feet and within less than 3 miles we were at 2519 feet. The panoramic views of San Jose, Silicon Valley and San Francisco are stunning. Most of the trail is in dirt road (not suitable for Road Bikes).

I’ve added DVD player like, Start, Pause, … buttons to the Route Player. It is still not quite hooked up right, so beware.

How to use GPX bounds to center the map

November 21, 2007

A GPX file has a bounds element that defines the coordinates of the bounding box of all the GPS points in the file. Here is an example:

<gpx version="1.0" ...>
<bounds minlat="37.221354973"

Here is how you can use the Google MAP API to center the routes based on the bounds element in the GPX file:

var b = xmlDoc.documentElement.getElementsByTagName("bounds");
var sw = new GLatLng(b[0].getAttribute("minlat"), b[0].getAttribute("minlon"));
var ne = new GLatLng(b[0].getAttribute("maxlat"), b[0].getAttribute("maxlon"));
var bounds = new GLatLngBounds(sw, ne);
map.setCenter(bounds.getCenter(), 12);

Here is the above code in action: Los Gatos, Stevens Creek Reservoir bike trail

Bike Trails in the Route Player

November 20, 2007

I updated the Route Player to take the URL to the GPX file as a parameter to the player and you’ll get the elevation and the map. Here is the bike route for the Kennedy/Shannon Road Trail. Here is the Los Gatos to San Jose trail. This player is still quite raw, the performance for relatively complicated route is spotty (e.g., the Pacific Grove / Pebble Beach route)

You’ll need to edit the GPX namespace specification before you try to use the player.

Lake Lexington Bike Trail

November 19, 2007

Lake Lexington Bike TrailThis morning, Allen and I went for bike ride around Lexington Lake. The ride started and ended at down town Los Gatos. The ride was 11.72 miles and took an hour and a half. The ride is relatively easy and quite relaxing. There are a few climbs that provide a good workout.

The Route Player that I’m writing is more functional than before. When you click on the thumbnail, you’ll see the elevation chart plus a google map displaying the route. As you hover over the elevation chart, a maker is shown on the route. The chart is in Flex and the map in DHTML. Both the Flex and the DHTML parts read the GPX file and convert the XML data into elevation chart and map route. (The slider is still not working).

GPX Player with Flex & Google Maps

November 18, 2007

GPX PlayerThe Route Player that I’m working on is coming along. The most difficult part of this pet project is finding time to spend on it. Anyhow, now it can read the GPX file (using Google Map AJAX APIs), display the route and as you mouse over the elevation chart (in FLEX), a marker is moved along the route to let you easily find out the steepest parts of the route, e.g.

There are couple of interesting aspects to this latest version of the player: reading the GPX file and positioning the marker. The function load below is called on page load. This initializes the map and reads the GPX data, and where each point recorded by the GPS device is converted to a GPoint. Here is an example of a GPS device point recorded in GPX 1.0 format:

<trkpt lat="37.222033069" lon="-121.983074527">

Here is the load function:

function load() {
   if (GBrowserIsCompatible()) {
   	initMap(720, 300);
	var request = GXmlHttp.create();"GET", "", true);
	request.onreadystatechange = function() {
	    if (request.readyState == 4) {
	        var xmlDoc = null;
	        var textLength = parseFloat(request.responseText.length);
	        if (textLength > 0) {
		    xmlDoc = GXml.parse(request.responseText);
	        } else {
		    xmlDoc = request.responseXML;
                var points = xmlDoc.documentElement.getElementsByTagName("trkpt");
	        var track = new Array();
	        for (var i = 0; i < points.length; i++) {
	            var point =
                      new GPoint(parseFloat(points[i].getAttribute("lon")),
	        var p = new GPolyline(track);
       // Send the request for data

When you hover over the elevation chart, the JavaScript function centerMap is called (view source the page). This function in turn moves the marker on the map.

var marker;
function centerMap(lat, lng) {
    if (marker != null) {
    var point = new GLatLng(lat, lng);
    marker = new GMarker(point);

Next I need to modify the code to allow loading of GPX files dynamically (perhaps specified via a URL parameter, e.g.) and I need to add playback feature to the player.

Elevation Chart in Flex with Google Maps

November 15, 2007

Flex with GoogleYou can mix DHTML and Flex in one page without too much effort. Here is how you do this:

  1. Add a DIV for the DHTML element that you wish to include after the embed Flash tags.
  2. Include the Google Map JavaScript as before in your HTML
  3. Add JavaScript methods that you wish to call from Flex
  4. In your Flex application, you can call these JavaScripts using the navigateToURL method. For example, as you move the mouse over the chart, the chartToolTip method is called which in turn updates the map.
    private function chartToolTip(e:HitData) : String {
       var s:String;
       s = "'" + LineSeries(e.element).displayName + "\n";
       s += "Time: " + e.item.x + " decimal hours\n";
       s += "Elevation: " + e.item.y + " meters\n";
       s += "Latitude: " + + " degrees\n";
       s += "Longitude: " + e.item.lon + " degrees\n";
       var u:URLRequest = new URLRequest("javascript:centerMap('"
             + "','"
             + e.item.lon + "')");
       return s;

My Route Player is no where near complete yet, but now at least I have some of the answers on how I will use Flex and Google maps to create this player. The code for this player is here. See also this article which may give you clues on how you could “embed” Google Map in a Flex control.

You can also overlay a Flex control on top of DHTML based Google map. Click here for details. Here is an example of a Flex overlay.