com presentations: Montreal UG Postboxes talk.: mongo-osm-confoo14.xml postbox-mug-montreal14.xml slides/map/goal-description.xml slides/map/import-script2.xml slides/map/osm-notes.png slides/map/pb-loc-to-desc-closest-cross.xml slides/map/pb-loc-to-desc-closest-pb.xml slides/map/pb-loc-to-desc-closest-street.xml slides/map/pb-loc-to-desc-crossing-street.xml slides/map/pb-loc-to-desc-direction.xml slides/map/pb-loc-to-desc-discard-same.xml slides
[email protected] (Derick Rethans)
| Newsgroups | php.pres |
|---|---|
| Message-ID | <[email protected]> |
Commit: cabb86a81a41fdfe83c2dfa62ee283d7409a9dde Author: Derick Rethans <[email protected]> Tue, 18 Feb 2014 09:35:28 +0000 Parents: afc0d470d349530e9d9b7e220304b0fd7ce36c23 Branches: master Link: http://git.php.net/?p=presentations.git;a=commitdiff;h=cabb86a81a41fdfe83c2dfa62ee283d7409a9dde Log: Montreal UG Postboxes talk. Changed paths: M mongo-osm-confoo14.xml A postbox-mug-montreal14.xml A slides/map/goal-description.xml M slides/map/import-script2.xml A slides/map/osm-notes.png A slides/map/pb-loc-to-desc-closest-cross.xml A slides/map/pb-loc-to-desc-closest-pb.xml A slides/map/pb-loc-to-desc-closest-street.xml A slides/map/pb-loc-to-desc-crossing-street.xml A slides/map/pb-loc-to-desc-direction.xml A slides/map/pb-loc-to-desc-discard-same.xml A slides/map/pb-loc-to-desc.xml A slides/map/pebble-nw14.png A slides/map/pebble.jpg A slides/map/pebble.xml A slides/map/postbox-architecture.png A slides/map/postbox-architecture.xml A slides/map/postbox-data.xml A slides/map/postbox-demo1.xml A slides/map/postbox-demo2.xml A slides/map/postbox-demo3.xml A slides/map/postbox-xml.xml A slides/map/postbox.jpg A slides/map/postbox.xml A slides/map/postbox1.png A slides/map/postbox2.png A slides/map/postbox3.png A slides/map/postbox4.png A slides/map/postboxhunting.xml
diff_cabb86a81a41fdfe83c2dfa62ee283d7409a9dde.txt
(text/plain, 14.1 KB)
diff --git a/mongo-osm-confoo14.xml b/mongo-osm-confoo14.xml index 5f66957..1e643a0 100644 --- a/mongo-osm-confoo14.xml +++ b/mongo-osm-confoo14.xml @@ -4,7 +4,7 @@ <title>Finding a pub with MongoDB and OpenStreetMap</title> <event>ConFoo</event> <location>Montréal, Canada</location> -<lat>45.49938</lat><lon>-73.56587</lon> +<lat>45.49938</lat><lon>-73.56787</lon> <date>February 27th, 2014</date> <speaker>Derick Rethans</speaker> <email>[email protected]</email> diff --git a/postbox-mug-montreal14.xml b/postbox-mug-montreal14.xml new file mode 100644 index 0000000..951eb22 --- /dev/null +++ b/postbox-mug-montreal14.xml @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="utf-8"?> +<presentation css="10gen-strict.css"> +<topic>MongoDB</topic> +<title>Hunting postboxes</title> +<event>Montreal MUG March Madness</event> +<lat>45.50038</lat><lon>-73.57015</lon> +<location>Montréal, Canada</location> +<date>February 25th, 2014</date> +<speaker>Derick Rethans</speaker> +<email>[email protected]</email> +<twitter>derickr</twitter> +<joindin>http://derickrethans.nl/talks/postbox-mug-montreal14</joindin> + +<slide>slides/mongodb/title.xml</slide> + +<slide>slides/map/postbox.xml</slide> +<slide>slides/map/pebble.xml</slide> + +<slide>slides/map/postboxhunting.xml</slide> +<slide>slides/map/postbox-data.xml</slide> + +<!-- A few words about our dataset --> +<slide>slides/mongodb/few-words-about-osm.xml</slide> +<slide>slides/map/osm-data.xml</slide> +<slide>slides/map/osm-xapi.xml</slide> + +<!-- Import --> +<slide>slides/mongodb/osm-import-mongo-section.xml</slide> +<slide>slides/mongodb/osm-schema4.xml</slide> + +<slide>slides/map/postbox-xml.xml</slide> +<slide>slides/map/import-script2.xml</slide> + +<!-- DEMO 1 --> +<slide>slides/map/postbox-demo1.xml</slide> + +<slide>slides/map/goal-description.xml</slide> +<slide>slides/map/postbox-architecture.xml</slide> + +<!-- FROM LOCATION TO DESCRIPTION --> +<slide>slides/map/pb-loc-to-desc.xml</slide> +<slide>slides/map/pb-loc-to-desc-closest-pb.xml</slide> +<slide>slides/map/pb-loc-to-desc-closest-street.xml</slide> +<slide>slides/map/pb-loc-to-desc-crossing-street.xml</slide> +<slide>slides/map/pb-loc-to-desc-discard-same.xml</slide> +<slide>slides/map/pb-loc-to-desc-closest-cross.xml</slide> +<slide>slides/map/pb-loc-to-desc-direction.xml</slide> + +<!-- DEMO 2 --> +<slide>slides/map/postbox-demo2.xml</slide> +<slide>slides/map/postbox-demo3.xml</slide> + + +<slide>slides/mongodb/resources.xml</slide> + +</presentation> diff --git a/slides/map/goal-description.xml b/slides/map/goal-description.xml new file mode 100644 index 0000000..6c45a6e --- /dev/null +++ b/slides/map/goal-description.xml @@ -0,0 +1,9 @@ +<slide> +<title>Notification on the Pebble</title> + +<list> + <bullet>Getting a map on the Pebble showing where the box is would be nice, but rather difficult</bullet> + <bullet>So a good description will do:</bullet> +</list> +<image filename="pebble-nw14.png"/> +</slide> diff --git a/slides/map/import-script2.xml b/slides/map/import-script2.xml index 0fb7f4a..ec0d7d3 100644 --- a/slides/map/import-script2.xml +++ b/slides/map/import-script2.xml @@ -15,16 +15,5 @@ </list> </bullet> </list> -<example> -"count" : 2801187 -"size" : 591099280 -"avgObjSize" : 211.0174 -"totalIndexSize" : 650564320 -"indexSizes" : { - "_id_" : 153463520, - "l_2dsphere" : 174737472, - "ts_1" : 182692720, - "ty_1" : 139670608 -} -</example> +<blurb>https://raw.github.com/derickr/3angle/master/import-data.php</blurb> </slide> diff --git a/slides/map/osm-notes.png b/slides/map/osm-notes.png new file mode 100644 index 0000000..ece530d Binary files /dev/null and b/slides/map/osm-notes.png differ diff --git a/slides/map/pb-loc-to-desc-closest-cross.xml b/slides/map/pb-loc-to-desc-closest-cross.xml new file mode 100644 index 0000000..94378cb --- /dev/null +++ b/slides/map/pb-loc-to-desc-closest-cross.xml @@ -0,0 +1,21 @@ +<slide> +<title>Find closest cross road</title> + +<example><![CDATA[ +$res = $c->aggregate( array( + '$geoNear' => array( + 'near' => $r['l'], + 'distanceField' => 'distance', + 'distanceMultiplier' => 1, + 'maxDistance' => 5000, + 'spherical' => true, + 'query' => [ + '_id' => [ '$in' => $intersectingWays ], + 'ts' => [ '$ne' => "name={$roadName}" ] + ], + 'limit' => 1, + ) +) );]]></example> + +<image filename="postbox4.png"/> +</slide> diff --git a/slides/map/pb-loc-to-desc-closest-pb.xml b/slides/map/pb-loc-to-desc-closest-pb.xml new file mode 100644 index 0000000..3de4833 --- /dev/null +++ b/slides/map/pb-loc-to-desc-closest-pb.xml @@ -0,0 +1,20 @@ +<slide> +<title>Closest Postbox</title> + +<example><![CDATA[<?php +$m = new MongoClient( 'mongodb://localhost' ); +$d = $m->selectDb( 'demo' ); $c = $d->selectCollection( 'poiConcat' ); +$center = new GeoJSONPoint( (float) $_GET['lon'], (float) $_GET['lat'] ); +$res = $c->aggregate( [ + '$geoNear' => [ + 'near' => $center->getGeoJson(), + 'distanceField' => 'distance', + 'distanceMultiplier' => 1, + 'maxDistance' => 5000, + 'spherical' => true, + 'query' => [ TAGS => 'amenity=post_box' ], + 'limit' => 1, + ] +] );]]></example> +<image filename="postbox1.png"/> +</slide> diff --git a/slides/map/pb-loc-to-desc-closest-street.xml b/slides/map/pb-loc-to-desc-closest-street.xml new file mode 100644 index 0000000..ac7479a --- /dev/null +++ b/slides/map/pb-loc-to-desc-closest-street.xml @@ -0,0 +1,18 @@ +<slide> +<title>Find closest street</title> + +<example><![CDATA[ +$r = $res['result'][0]; +$query = [ + LOC => [ + '$near' => $r['l'] + ], + TAGS => new MongoRegex( + '/^highway=(trunk|pedestrian|service|primary|secondary|tertiary|residential)/' + ) +]; +$road = $c->findOne( $query ); +]]></example> +<br/> +<image filename="postbox2.png"/> +</slide> diff --git a/slides/map/pb-loc-to-desc-crossing-street.xml b/slides/map/pb-loc-to-desc-crossing-street.xml new file mode 100644 index 0000000..7be1233 --- /dev/null +++ b/slides/map/pb-loc-to-desc-crossing-street.xml @@ -0,0 +1,17 @@ +<slide> +<title>Find crossing streets</title> + +<example><![CDATA[ +$q = $c->find( [ + 'l' => [ + '$geoIntersects' => [ '$geometry' => $road['l'] ] + ], + 'ts' => new MongoRegex( + '/^highway=(trunk|pedestrian|service|primary|secondary|tertiary|residential)/' + ), + '_id' => [ '$ne' => $road['_id'] ], +] );]]></example> + +<br/> +<image filename="postbox3.png"/> +</slide> diff --git a/slides/map/pb-loc-to-desc-direction.xml b/slides/map/pb-loc-to-desc-direction.xml new file mode 100644 index 0000000..ed11e17 --- /dev/null +++ b/slides/map/pb-loc-to-desc-direction.xml @@ -0,0 +1,15 @@ +<slide> +<title>Finding the direction</title> +<iframe width="1000" align="center" height="200" filename='examples/3angle/?l=gc&lon=:-:lon:-:&lat=:-:lat:-:&zoom=4'/> + +<blurb>Formula:</blurb> +<example> +θ = atan2( + sin(Δλ).cos(φ2), + cos(φ1).sin(φ2) − sin(φ1).cos(φ2).cos(Δλ) +) +</example> + +<blurb>Implemented in php-geospatial:</blurb> +<blurb>https://github.com/php-geospatial/geospatial/blob/master/geospatial.c#L623</blurb> +</slide> diff --git a/slides/map/pb-loc-to-desc-discard-same.xml b/slides/map/pb-loc-to-desc-discard-same.xml new file mode 100644 index 0000000..a18b3f6 --- /dev/null +++ b/slides/map/pb-loc-to-desc-discard-same.xml @@ -0,0 +1,14 @@ +<slide> +<title>Discard roads</title> + +<blurb>Find all roads with a name, but not the same as our original road</blurb> +<example><![CDATA[$intersectingWays = array(); +foreach ( $q as $crossRoad ) +{ + $crossTags = Functions::split_tags( $crossRoad[TAGS] ); + if ( !in_array( "name={$roadName}", $crossRoad ) && array_key_exists( 'name', $crossTags ) ) + { + $intersectingWays[] = $crossRoad['_id']; + } +}]]></example> +</slide> diff --git a/slides/map/pb-loc-to-desc.xml b/slides/map/pb-loc-to-desc.xml new file mode 100644 index 0000000..9a8df03 --- /dev/null +++ b/slides/map/pb-loc-to-desc.xml @@ -0,0 +1,12 @@ +<slide> +<title>From location to description</title> + +<list> +<bullet>Find nearest postbox</bullet> +<bullet>Find closest street</bullet> +<bullet>Find all crossing streets</bullet> +<bullet>Discard all streets with the same name</bullet> +<bullet>Find cross road closest to postbox location</bullet> +<bullet>Calculate direction</bullet> +</list> +</slide> diff --git a/slides/map/pebble-nw14.png b/slides/map/pebble-nw14.png new file mode 100644 index 0000000..71966b0 Binary files /dev/null and b/slides/map/pebble-nw14.png differ diff --git a/slides/map/pebble.jpg b/slides/map/pebble.jpg new file mode 100644 index 0000000..69f4663 Binary files /dev/null and b/slides/map/pebble.jpg differ diff --git a/slides/map/pebble.xml b/slides/map/pebble.xml new file mode 100644 index 0000000..ff92a26 --- /dev/null +++ b/slides/map/pebble.xml @@ -0,0 +1,4 @@ +<slide> +<br/> +<image filename="pebble.jpg"/> +</slide> diff --git a/slides/map/postbox-architecture.png b/slides/map/postbox-architecture.png new file mode 100644 index 0000000..e1fcc83 Binary files /dev/null and b/slides/map/postbox-architecture.png differ diff --git a/slides/map/postbox-architecture.xml b/slides/map/postbox-architecture.xml new file mode 100644 index 0000000..2eb2d55 --- /dev/null +++ b/slides/map/postbox-architecture.xml @@ -0,0 +1,5 @@ +<slide> +<title>Architecture</title> + +<image filename="postbox-architecture.png"/> +</slide> diff --git a/slides/map/postbox-data.xml b/slides/map/postbox-data.xml new file mode 100644 index 0000000..fb5128c --- /dev/null +++ b/slides/map/postbox-data.xml @@ -0,0 +1,9 @@ +<slide> +<title>Postbox data source</title> + +<list> +<bullet>I am only going to care about the UK for now</bullet> +<bullet>OpenStreetMap has quite a lot of postboxes mapped</bullet> +<bullet>http://edwardbetts.com/postboxes/ ?</bullet> +</list> +</slide> diff --git a/slides/map/postbox-demo1.xml b/slides/map/postbox-demo1.xml new file mode 100644 index 0000000..b099f48 --- /dev/null +++ b/slides/map/postbox-demo1.xml @@ -0,0 +1,30 @@ +<slide> +<title>The Nearest Postboxes</title> + +<iframe align="right" width="500" filename='examples/3angle/?l=postboxes&lon=:-:lon:-:&lat=:-:lat:-:&zoom=15'/> + +<example> +<![CDATA[<?php +$m = new MongoClient( 'mongodb://localhost' ); +$d = $m->selectDb( DATABASE ); +$c = $d->selectCollection( COLLECTION ); +$center = new GeoJSONPoint( + (float) $_GET['lon'], + (float) $_GET['lat'] +); +$res = $c->aggregate( [ + [ '$geoNear' => [ + 'near' => $center->getGeoJson(), + 'distanceField' => 'distance', + 'distanceMultiplier' => 1, + 'maxDistance' => 1000, + 'spherical' => true, + 'query' => + [ TAGS => 'amenity=post_box' ], + 'limit' => 40, + ) ), + [ '$sort' => [ 'distance' => 1 ] ], +) ); +]]> +</example> +</slide> diff --git a/slides/map/postbox-demo2.xml b/slides/map/postbox-demo2.xml new file mode 100644 index 0000000..de3d1db --- /dev/null +++ b/slides/map/postbox-demo2.xml @@ -0,0 +1,5 @@ +<slide> +<title>The Nearest Postboxes</title> + +<iframe width="1000" filename='examples/3angle/?l=postbox,postboxes&lon=-0.1979387&lat=51.5384754&zoom=16'/> +</slide> diff --git a/slides/map/postbox-demo3.xml b/slides/map/postbox-demo3.xml new file mode 100644 index 0000000..44f2ed9 --- /dev/null +++ b/slides/map/postbox-demo3.xml @@ -0,0 +1,5 @@ +<slide> +<title>The Real Goal™</title> + +<image filename="osm-notes.png"/> +</slide> diff --git a/slides/map/postbox-xml.xml b/slides/map/postbox-xml.xml new file mode 100644 index 0000000..2c2b03b --- /dev/null +++ b/slides/map/postbox-xml.xml @@ -0,0 +1,42 @@ +<slide> +<title>Example data point</title> + +<div effect="fade-out"> +<blurb>In OpenStreetMap:</blurb> +<example><![CDATA[ + <node id="877879696" version="5" timestamp="2013-10-12T11:16:57Z" uid="238584" user="mcld" changeset="18312789" lat="51.5185648" lon="-0.1685154"> + <tag k="amenity" v="post_box"/> + <tag k="box_type" v="pillar_box_dual_aperture"/> + <tag k="collection_plate" v="CP1"/> + <tag k="collection_times" v="Mo-Fr 18:30; Sa 12:00"/> + <tag k="post_box:apertures" v="2"/> + <tag k="ref" v="W2 68"/> + <tag k="royal_cypher" v="EIIR"/> + <tag k="source:ref" v="survey"/> + </node> +]]></example> +</div> +<div effect="fade-in"> +<blurb>In MongoDB:</blurb> +<example> +{ + "_id" : "n877879696", + "l" : { + "type" : "Point", + "coordinates" : [ -0.1685154, 51.5185648 ] + }, + "ts" : [ + "amenity=post_box", + "box_type=pillar_box_dual_aperture", + "collection_plate=CP1", + "collection_times=Mo-Fr 18:30; Sa 12:00", + "post_box:apertures=2", + "ref=W2 68", + "royal_cypher=EIIR", + "source:ref=survey" + ], + "ty" : NumberLong(1) +} +</example> +</div> +</slide> diff --git a/slides/map/postbox.jpg b/slides/map/postbox.jpg new file mode 100644 index 0000000..a2bfb8b Binary files /dev/null and b/slides/map/postbox.jpg differ diff --git a/slides/map/postbox.xml b/slides/map/postbox.xml new file mode 100644 index 0000000..ce0aca7 --- /dev/null +++ b/slides/map/postbox.xml @@ -0,0 +1,4 @@ +<slide> +<br/> +<image filename="postbox.jpg"/> +</slide> diff --git a/slides/map/postbox1.png b/slides/map/postbox1.png new file mode 100644 index 0000000..e13609c Binary files /dev/null and b/slides/map/postbox1.png differ diff --git a/slides/map/postbox2.png b/slides/map/postbox2.png new file mode 100644 index 0000000..04ab3dc Binary files /dev/null and b/slides/map/postbox2.png differ diff --git a/slides/map/postbox3.png b/slides/map/postbox3.png new file mode 100644 index 0000000..6db8a6d Binary files /dev/null and b/slides/map/postbox3.png differ diff --git a/slides/map/postbox4.png b/slides/map/postbox4.png new file mode 100644 index 0000000..c291ad0 Binary files /dev/null and b/slides/map/postbox4.png differ diff --git a/slides/map/postboxhunting.xml b/slides/map/postboxhunting.xml new file mode 100644 index 0000000..222d532 --- /dev/null +++ b/slides/map/postboxhunting.xml @@ -0,0 +1,9 @@ +<slide> +<title>Hunting for Postboxes</title> + +<list> +<bullet>I ♥ postboxes</bullet> +<bullet>I need another hobby project</bullet> +<bullet>A Pebble app to find postboxes for photographing!</bullet> +</list> +</slide>