Walking the London LOOP - part 9

Due to abysmal weather, we moved our walk to Monday this weekend. That was not much of a problem as it was Easter Monday.

loop9-d36_5167.jpg

We traveled back to Kingston and crossed the bridge over the Thames. Just before entering Bushy Park, we passed a perculiar few trees... they had loads of shoes in them! All a similar style as well. The first part through Bushy Park were open fields, and a few ponds with birds nesting in the reeds around it.

loop9-d36_5185.jpg

After a while we crossed a road and ended up at the Woodland Gardens. They consist of two plantations, the Pheasentry Plantation and the Waterhouse Plantation. We had a few issues finding the entrance to the first one, as they had slightly changed the gates. Of course, I have now fixed that in OpenStreetMap. Both "Plantations" are quite different. The first one has more open spaces where the second one is much more dense woodland. In both plantations, everything was very much in bloom.

When leaving the plantations we proceeded through Bushy Park and went the wrong way. That wasn't really bad, as we ended up at the Water Gardens, which only recently opened the public.

After Bushy Park we were a bit thirsty and made a little detour to find a pub, The Windmill. The original idea was to have a quick meal there as well, but the menu was limited and the bar staff rather grumpy. We just stuck around for a pint, and made another detour to find lunch—the local Sainsbury's.

After picking up lunch we followed a few residential streets and found the Crane River, past which we would walk for almost all of the rest of the walk.

loop9-d36_5201.jpg

The park near the river had some good walking paths and it was also the place where we enjoyed our bought sandwiches, crisps and drinks on a bench, in the sun, with flocks of parakeets and airlines flying over.

loop9-d36_5206.jpg

After a while we came upon the Shot Tower, where they previously made "shot" for guns. Near the Shot Tower is also the entrance to the Crane Park Nature Reserve which we probably should have visited as well, but didn't.

After another small stretch of road, we entered Hounslow Heath and from there on we continued through Brazil Mill Woods, Donkey Wood and the Causeway all the way to the Great South West Road. I think we were lucky that it was a Sunday, as there was nearly no traffic.

loop9-d36_5214.jpg

The end of the walk was at Hatton Cross station, near the end of Heathrow's runway 09R/27L. You would probably not be surprised that many planes flew over!

The weather was warm with 16-18°C, but also muggy. We were a lot sweatier than on previous walks.

The photos that I took on this section, as well as the photos of the other sections of the LOOP, are available as a Flickr set.

Shortlink

This article has a short URL available: http://drck.me/loop9-axp

Comments

No comments yet

Walking the London LOOP - part 7 and 8

Section 7

loop7-d36_5118.jpg

Another double whammy. We started out with a trek to Banstead. A trek, because there are no trains to Banstead on Sundays. So tube to Elephant and Castle, then trying to find the national rail station there—not an easy feat, then a train to Epson and then finally a bus ride to Belmont, where we had to walk over the Banstead Downs, and the golf course, to the start of section 7.

loop7-d36_5124.jpg

Section 7 is one of the shortest sections, at only 3½ miles. It starts by crossing the golf club, and then continues through some posh streets. At the time of year that we were there (April) there were lots of trees with blossom and flowers, like tulips. Even though the streets are not busy, it would have been better if we could go past another golf course, but apparently they're been annoying and not granting access past their course.

loop7-d36_5127.jpg

After a while we walked through Warren Farm, just before we got to Nonsuch Park. The latter is the last surviving part of the Little Park of Nonsuch, a deer hunting park established by Henry VIII of England surrounding the former Nonsuch Palace, of which there are some vague ruins to be seen.

After coming through the park, we "ran into" the Spring Tavern in Ewell for lunch and a pint.

Section 8

After lunch we came through Bourne Hall Park where section 7 ends and section 8 starts. With 7 being so short, there was plenty of time to also finish section 8.

loop8-d36_5140.jpg

The start of section 8 is also the source of the Hogsmill river. And the whole route of section 8 tries to follow the river as closely as possible. In some places that was not really possible so we had some diversions through residential areas, and slightly smellier, through the Hogsmill Valley Sewage Treatment Works. But most of it, was pleasent walking past the river.

loop8-d36_5151.jpg

Near the end we came to Kingston-Upon-Thames were it was again a bit trickier to follow the river.

loop8-d36_5157.jpg

With the weather being so nice, we had to stop for a few pints at the end of the walk, at two of Kingston's river side pubs, the Bishop and the Gazebo next door!

The weather was again very good, with 16-18°C and no clouds to be seen. We took just over four hours for the two sections that together were 20.3km long.

The photos that I took on this section, as well as the photos of the other sections of the LOOP, are available as a Flickr set.

Shortlink

This article has a short URL available: http://drck.me/loop78-axg

Comments

Fish and chips for lunch were definitely the way to go :-)

Cursors and the Aggregation Framework

With MongoDB 2.6 released, the PHP driver for MongoDB has also seen many updates to support the features in the new MongoDB release. In this series of articles, I will illustrate some of those.

In this article, I will introduce command cursors and demonstrate how they can be applied to aggregations. I previously wrote about the Aggregation Framework last year, but since then it has received a lot of updates and improvements. One of those improvements relates to how the Aggregation Framework (A/F) returns results. Before MongoDB 2.6, the A/F could only return one document, with all the results stored under the results key:

<?php
$m = new MongoClient;
$c = $m->demo->cities;

$pipeline = [
     [ '$group' => [
          '_id' => '$country_code',
          'timezones' => [ '$addToSet' => '$timezone' ]
     ] ],
     [ '$sort' => [ '_id' => 1 ] ],
];

$r = $c->aggregate( $pipeline );
var_dump( $r['result'] );
?>

This code would output something like:

array(242) {
  [0] =>
  array(2) {
     '_id' => string(2) "AD"
     'timezones' => array(1) { [0] => string(14) "Europe/Andorra" }
  }
  [1] =>
  array(2) {
     '_id' => string(2) "AE"
     'timezones' => array(1) { [0] => string(10) "Asia/Dubai" }
  }
  [2] =>
  array(2) {
     '_id' => string(2) "AF"
     'timezones' => array(1) { [0] => string(10) "Asia/Kabul" }
  }
  …

MongoCollection::aggregate() is implemented under the hood as a database command. The method in the PHP driver merely wraps this, but you can also call A/F through the MongoDB::command() method:

<?php
$m = new MongoClient;
$d = $m->demo;

$pipeline = [
     [ '$group' => [
          '_id' => '$country_code',
          'timezones' => [ '$addToSet' => '$timezone' ]
     ] ],
     [ '$sort' => [ '_id' => 1 ] ],
];

$r = $d->command( [
     'aggregate' => 'cities',
     'pipeline' => $pipeline,
] );
var_dump( $r['result'] );
?>

Because a database command only returns one document, the result is limited to a maximum of 16MB. This is not a problem for my example, but it can can certainly be a limiting factor for other A/F queries.

MongoDB 2.6 adds support for returning a cursor for an aggregation command. With the raw command interface, you simply add the extra cursor element:

$r = $d->command( [
     'aggregate' => 'cities',
     'pipeline' => $pipeline,
     'cursor' => [ 'batchSize' => 1 ],
] );
var_dump( $r );

Instead of a document with all results inline, you get a cursor definition back:

array(2) {
  'cursor' =>
  array(3) {
     'id' => class MongoInt64#5 (1) {
          public $value => string(12) "392201189815"
     }
     'ns' => string(11) "demo.cities"
     'firstBatch' => array(1) {
       [0] =>
       array(2) {
          '_id' => string(2) "AD"
          'timezones' => array(1) { [0] => string(14) "Europe/Andorra" }
       }
     }
  }
  'ok' => double(1)
}

The cursor definition contains the cursor ID (in id), the namespace (ns), and whether the command succeeded (in ok). The definition also a portion of the results. The number of items in firstBatch is configured by the value given to batchSize in the command.

To create a cursor that you can iterate over in PHP, you need to convert this cursor definition to a MongoCommandCursor object. You can do that with the MongoCommandCursor::createFromDocument() factory method. This factory method takes three arguments: the MongoClient object ($m in my example), the connection hash, and the cursor definition that was returned. The hash is required so that we can fetch new results from the same connection that executed the original command.

To obtain the connection hash, we need to include a by-ref variable as the third argument to MongoCollection::command():

<?php
$m = new MongoClient;
$d = $m->demo;

$pipeline = [
     [ '$group' => [
          '_id' => '$country_code',
          'timezones' => [ '$addToSet' => '$timezone' ]
     ] ],
     [ '$sort' => [ '_id' => 1 ] ],
];

$r = $d->command(
     [
          'aggregate' => 'cities',
          'pipeline' => $pipeline,
          'cursor' => [ 'batchSize' => 1 ],
     ],
     null,
     $hash
);
var_dump( $hash );

The hash looks like localhost:27017;-;.;26415. Together with the result, you can now construct a MongoCommandCursor:

$cursor = MongoCommandCursor::createFromDocument( $m, $hash, $r );

And iterate over it:

foreach ( $cursor as $result )
{
     echo $result['_id'], ': ', join( ', ', $result['timezones'] ), "\n";
}
?>

As this is all a bit cumbersome, we have also added a helper method for this: MongoCollection::aggregateCursor. This internally does the whole MongoCommandCursor creation dance, and simplifies the previous example to:

<?php
$m = new MongoClient;
$c = $m->demo->cities;

$pipeline = [
     [ '$group' => [
          '_id' => '$country_code',
          'timezones' => [ '$addToSet' => '$timezone' ]
     ] ],
     [ '$sort' => [ '_id' => 1 ] ],
];

$r = $c->aggregateCursor( $pipeline );

foreach ( $r as $result )
{
     echo $result['_id'], ': ', join( ', ', $result['timezones'] ), "\n";
}
?>

This helper also automatically sets the initial batch size to 101. You can change the batchSize for subsequent batches by using the MongoCommandCursor::batchSize() method, and for the initial batch by specifying an option to MongoCollection::aggregateCursor:

$options = [ 'cursor' => [ 'batchSize' => 5 ] ];

$r = $d->cities->aggregateCursor( $pipeline, $options );
$r->batchSize( 25 );

In general, you probably should not change the default batch sizes.

The Aggregation Framework has some other new features in MongoDB 2.6 as well. Please refer to the release notes for more information. I might write another post on some of those features later, too.

Shortlink

This article has a short URL available: http://drck.me/aggrcur-ax5

Comments

No comments yet

Walking the London LOOP - part 5 and 6

Section 5

While waking up we already knew this would be a glorious day. Blue skies with no clouds in sight. The moment I got out of the house I knew I was not going to need my coat either. Getting to Hamsey Green, the start of section 5 was a bit more of a chore than normally. It involved two tube trains to Victoria, a train to West Croydon and then another bus ride down the road to Ken's Auto at Hamsey Green.

loop5-d36_4980.jpg

After a short section next to a road, we entered Riddlesdown. With mostly open fields and a bit of woodland we made it down into the next valley, coming past a disused quarry. We only really noticed the quarry once we made it over a bridge across some railroad tracks and up a fairly steep path up the hill on the other side of the valley.

loop5-d36_4992.jpg

After some steps, and some more steep uphill part we came to Kenley Common, a now open space that used to be farmland, as a swap for the Kenley Aerodrome that the RAF seconded during the second World War. We made a few wrong turns on Kenley Common and there were a few slightly useless fences. Passing through some woods and a field with gliders overhead, we "suddenly" found ourselves at the Wattenden Arms, a pub displaying much WWII memorabilia from the Kenley Aerodrome. The friendly staff served a decent pint, and after refreshing ourselves we continued the walk.

After climbing our first style we were overtaken by another LOOP walker as we passed by the Kenley Observatory and a friendly horse. For a bit we had to walk past a road without footpath or pavement.

loop5-d36_5007.jpg

After that we passed by a field with a sole postbox and then made our way to Happy Valley. With the Sun blazing and everything looking greener that it probably was we descended into the valley and back out on the other end. The signing of the LOOP was a bit confusing so I don't think we followed the route correctly, but we picked up the walk again just shy of the next common, Farthing Downs.

This part of the walk was over a hill crest with the skyline of London in the far background. The section ended with a slight downhill into Coulsdon were we stopped for some refreshments—most importantly cake—at the Poppy Cafe. Because the weather was so nice, we decided to continue with the following section as well, section 6.

Section 6

loop6-d36_5021.jpg

Passing through South Coulsdon station we had a long climb up a residential road before we continued on a bridleway. With a long section through some woods and farmland around, a slight detour around a road without pavement, we came upon the Mayfield Lavender Fields. Sadly, we were too early to see it all in bloom, but there was most definitely already a hint of purple to be seen.

loop6-d36_5052.jpg

We then walked through Oak's Park, after which there was another long straight section on the edge of Surrey that took us past HMP Highdown. Luckily most of it was hidden by hedges and trees. The last part of this much shorter section took us to the Banstead Downs and over the Banstead Downs Golf Club to the end of the walk. From there it was a short link to Banstead, where we luckily only had to wait 20 minutes for the train—there is only a service every hour.

Where section 5 was mostly known for its up and downs, section 6 was the "horse" section. Lots of bridleways and horses around.

The weather was very good, with 16-18°C and no clouds to be seen. We took nearly four and a half hours for the two sections that together were 19.4km long.

The photos that I took on this section, as well as the photos of the other sections of the LOOP, are available as a Flickr set.

Shortlink

This article has a short URL available: http://drck.me/loop56-awu

Comments

No comments yet

Walking the London LOOP - part 4

Another weekend, and another section of the LOOP. This time Morag and I left home a bit earlier as we knew this was one of the longer sections of the LOOP at 9 miles.

loop4-d36_4734.jpg

We took the train to Hayes (Kent) and followed a slightly different route to the start of the section. At the end of last one we really could do without the two fairly steep hills. After getting to the start, we soon found ourselves on the Greenwich Meridian, even though the GPS indicated crossing the line about 200 meters earlier. Passing St. John's church the LOOP wanted to takes us right through a "lake", previously the Sparrows Den Playing Fields, but currently flooded due to high levels of ground water. Some jokers had also put a bunch of yellow rubber ducks on the "lake".

loop4-d36_4753.jpg

We found our way around the field and continued towards our first wooded section, afraid of more mud. Instead, we were greated by a collapsed tree on the path. Some mud did show up, but not nearly as much as on previous sections. We came out of the woods and had to follow a decent stretch along a road, then past a "high school" and its playing fields until we came past a promising looking pub, The Sandrock. Although it was open, it was so quiet in there that we continued by climbing up the Addington Hills to treat us to a fine panorama over London. Wembley Stadium, the City and Canary Wharf were all very easy to spot.

loop4-d36_4917.jpg loop4-d36_4933.jpg

After a quick break and avoiding having Chinese food we came onto Tramlink station Coombe Lane after which we disappear in more woods. This time around Heathfield House and Bramley Bank. From there we continued onwards towards more woods (can you believe it!) and around a water tower.

By now, we were definitely hungry (and thirsty) so we decided to make a slight detour into Selsdon to have a bite and pint at The Sir Julian Huxley, a Weatherspoons.

loop4-d36_4966.jpg

After lunch we continued our walk by going through more woods: Selsdon Wood and Puplet Wood. For the first time, we went just outside of Greater London into Surrey. After encountering Elm Farm in Farleigh we fled back into London past some fields to make it to Hamsey Green, the end of the walk. If the previous sections could be called "muddy", this section clearly had a preference for "woods". A bus, train and two tubes later we got home, exhausted.

The weather was mostly good, but colder at 10-12°C and some rain threatened to wet us near the start. We took just over four and a half hours for the 21.1km walk (including detours).

The photos that I took on this section, as well as the photos of the other sections of the LOOP, are available as a Flickr set.

Shortlink

This article has a short URL available: http://drck.me/loop4-awk

Comments

No comments yet

Life Line