com presentations: Added my new Mongo Geo talk.: mongo-geo-mongouk13.xml mongo-osm-montreal-evening.xml slides/mongodb/cells-coverings.xml
slides/mongodb/cells-level10-example-london-1.xml slides/mongodb/cells-level10-example-london-2.xml slides/mongodb/cells-level10-example-london-3.xml
slides/mongodb/cells-level3-example-uk-1.xml slides/mongodb/cells-level3-example-uk-2.xml slides/mongodb/cells-level3-example-uk-3.xml
slides/mongodb/cells-level

From: Date: Wed, 03 Apr 2013 22:51:54 +0000
Subject: com presentations: Added my new Mongo Geo talk.: mongo-geo-mongouk13.xml mongo-osm-montreal-evening.xml slides/mongodb/cells-coverings.xml
slides/mongodb/cells-level10-example-london-1.xml slides/mongodb/cells-level10-example-london-2.xml slides/mongodb/cells-level10-example-london-3.xml
slides/mongodb/cells-level3-example-uk-1.xml slides/mongodb/cells-level3-example-uk-2.xml slides/mongodb/cells-level3-example-uk-3.xml
slides/mongodb/cells-level
Groups: php.pres 
Request: Send a blank email to pres+get-1874@lists.php.net to get a copy of this message
Commit: 05c98f0367856b7ae8ee21676af1ed1a3ff42962 Author: Derick Rethans <github@derickrethans.nl> Wed, 3 Apr 2013 23:51:54 +0100 Parents: f562a300124fbcc4252c5d2907571d2f88f13f35 Branches: master Link: http://git.php.net/?p=presentations.git;a=commitdiff;h=05c98f0367856b7ae8ee21676af1ed1a3ff42962 Log: Added my new Mongo Geo talk. Changed paths: A mongo-geo-mongouk13.xml M mongo-osm-montreal-evening.xml A slides/mongodb/cells-coverings.xml A slides/mongodb/cells-level10-example-london-1.xml A slides/mongodb/cells-level10-example-london-2.xml A slides/mongodb/cells-level10-example-london-3.xml A slides/mongodb/cells-level3-example-uk-1.xml A slides/mongodb/cells-level3-example-uk-2.xml A slides/mongodb/cells-level3-example-uk-3.xml A slides/mongodb/cells-level3-example-uk-4.xml A slides/mongodb/cells.xml A slides/mongodb/charingcross.png A slides/mongodb/few-words-about-osm.xml A slides/mongodb/geo-2.2.xml A slides/mongodb/geo-aggregation.xml A slides/mongodb/geo-aggregation2-php.xml A slides/mongodb/geo-aggregation2.xml A slides/mongodb/geo-in-2.4.xml A slides/mongodb/geo-indexes.xml A slides/mongodb/geo-intersects-1.xml A slides/mongodb/geo-intersects.xml A slides/mongodb/geo-near-explanation-0.xml A slides/mongodb/geo-near-explanation-1.xml A slides/mongodb/geo-near-explanation-2.xml A slides/mongodb/geo-near-explanation-3.xml A slides/mongodb/geo-near-explanation-4.xml A slides/mongodb/geo-near-explanation-5.xml A slides/mongodb/geo-near-explanation-6.xml A slides/mongodb/geo-near-explanation-7.xml A slides/mongodb/geo-near.xml A slides/mongodb/geo-within-1.xml A slides/mongodb/geo-within-2.xml A slides/mongodb/geo-within-index.png A slides/mongodb/geo-within-intersects-explanation.xml A slides/mongodb/geo-within.xml A slides/mongodb/geojson-line.png A slides/mongodb/geojson-linestring.xml A slides/mongodb/geojson-point.png A slides/mongodb/geojson-point.xml A slides/mongodb/geojson-polygon.png A slides/mongodb/geojson-polygon.xml A slides/mongodb/geojson.xml A slides/mongodb/hydepark.png A slides/mongodb/intersects-1.png A slides/mongodb/introducing-2dsphere.xml A slides/mongodb/ldn-line.png A slides/mongodb/ldn-point.png A slides/mongodb/ldn-polygon.png A slides/mongodb/near-1.png A slides/mongodb/near-2..png A slides/mongodb/near-3.png A slides/mongodb/near-4.png A slides/mongodb/near-5.png A slides/mongodb/near-6.png A slides/mongodb/near-7.png A slides/mongodb/near-pub.png A slides/mongodb/pubs-distance.png M slides/mongodb/resources.xml A slides/mongodb/stjamesspark.xcf A slides/mongodb/summary.xml A slides/mongodb/uk-grid-0.png A slides/mongodb/uk-grid-1.png A slides/mongodb/uk-grid-2.png A slides/mongodb/uk-grid-3.png A slides/mongodb/what-is-geo.xml A slides/mongodb/within-1.png A slides/mongodb/within-2.png

diff --git a/mongo-geo-mongouk13.xml b/mongo-geo-mongouk13.xml new file mode 100644 index 0000000..de8b105 --- /dev/null +++ b/mongo-geo-mongouk13.xml @@ -0,0 +1,216 @@ +<?xml version="1.0" encoding="utf-8"?> +<presentation css="10gen-strict.css"> +<topic>MongoDB</topic> +<title>Finding a Pub with MongoDB 2.4 Geo Features</title> +<event>MongoDB UK</event> +<location>London, UK</location> +<date>April 9th, 2013</date> +<speaker>Derick Rethans</speaker> +<email>derick@10gen.com</email> +<twitter>derickr</twitter> +<joindin>http://derickrethans.nl/talks/mongo-geo-mongouk13</joindin> + +<slide>slides/mongodb/title.xml</slide> + +<!-- A few words about our dataset --> +<slide>slides/mongodb/few-words-about-osm.xml</slide> +<!-- Introduction, what is geo --> +<slide>slides/mongodb/what-is-geo.xml</slide> + +<!-- GEO in 2.2 + Planar with occasional spherical distance + $nearSphere, $centerSphere + Limited spherical behavior (wrapping) + Indexes only points + $near(Sphere) finds Points near a point + $geoWithin finds points within a circle or a polygon + Index required for everything + + Index type: 2d +--> +<slide>slides/mongodb/geo-2.2.xml</slide> + +<!-- + Lines and Polygons and points can be indexed. + + Multiple geo fields can be indexed. + Find me air routes where the start is within 50mi of NYC and the end points is within 50mi of Miami + Geo fields fully indexed in 2dsphere, only one indexed in 2d + Geo field doesn't have to be first indexed field. + Speeds up certain queries a lot. + No driver changes needed, since only added new queries. +--> +<slide>slides/mongodb/introducing-2dsphere.xml</slide> + +<!-- DATA STORAGE --> +<!-- + No more [ lon, lat ], but geojson instead + +SAY WHERE ELSE GeoJson is used +--> +<slide>slides/mongodb/geojson.xml</slide> + +<!-- + POINT: + show an image, and the GeoJson under +--> +<slide>slides/mongodb/geojson-point.xml</slide> +<!-- + LINESTRING: + show an image, and the GeoJson under +--> +<slide>slides/mongodb/geojson-linestring.xml</slide> +<!-- + POLYGON: + show an image, and the GeoJson under +--> +<slide>slides/mongodb/geojson-polygon.xml</slide> + +<!-- + CELLS, + We divide the surface of the earth into cells + A library called S2 from Google does the hard work + Cells have a level which define the size of the cell. + S2 provides 31 levels + The higher the level, the smaller the cell, and therefore the more needed to cover the earth + By default, we use all levels between 500m on a side and 100km on a side +--> +<slide>slides/mongodb/cells.xml</slide> +<!-- + Show grid over the UK + Explain coverings + highlight scotland +--> +<slide>slides/mongodb/cells-level3-example-uk-1.xml</slide> +<!-- + Coverings are a set of cells that cover a geometry + The last slide had a very coarse covering of North America + Coverings are the basis of the 2dsphere index. +--> +<slide>slides/mongodb/cells-coverings.xml</slide> +<slide>slides/mongodb/cells-level3-example-uk-2.xml</slide> +<slide>slides/mongodb/cells-level3-example-uk-3.xml</slide> +<slide>slides/mongodb/cells-level3-example-uk-4.xml</slide> + +<!-- + Show grid of (part of) London: + - Point, Westminster palace + - Line, Oxford Street + - Polygon, Hyde Park +--> +<slide>slides/mongodb/cells-level10-example-london-1.xml</slide> +<slide>slides/mongodb/cells-level10-example-london-2.xml</slide> +<slide>slides/mongodb/cells-level10-example-london-3.xml</slide> + + +<!-- operators + $near + find stuff near a point + index required + $geoWithin + find stuff within a polygon/circle + index NOT required + $geoIntersects + find stuff that intersects with other stuff + index NOT required + +--> +<slide>slides/mongodb/geo-in-2.4.xml</slide> + +<!-- near + - Example with road and park + - slide with index/no index, and comparsion with 2.2? +--> +<!-- geoWithin + - Example with road and park + - slide with index/no index, and comparsion with 2.2? +--> +<!-- geoIntersects + - Example with road and park + - slide with index/no index, and comparsion with 2.2? +--> +<slide>slides/mongodb/geo-near.xml</slide> + +<!-- + NEAR + + Starts from a point + Looks at concentric donuts from that point + Want to look at documents within the donut + If distance from query point to document is within the donut, output + Adapts size of the donut as needed +--> +<slide>slides/mongodb/geo-near-explanation-0.xml</slide> +<slide>slides/mongodb/geo-near-explanation-1.xml</slide> +<slide>slides/mongodb/geo-near-explanation-2.xml</slide> +<slide>slides/mongodb/geo-near-explanation-3.xml</slide> +<slide>slides/mongodb/geo-near-explanation-4.xml</slide> +<slide>slides/mongodb/geo-near-explanation-5.xml</slide> +<slide>slides/mongodb/geo-near-explanation-6.xml</slide> +<slide>slides/mongodb/geo-near-explanation-7.xml</slide> + +<!-- + GeoWithin/GeoIntersecs + + Generate a covering for geometry in query + Look at all points in all overlapping cells + Cells may be larger or smaller than our covering + Must look at cells that contain our covering + Must look at cells that we contain + See if documents are within or intersect our query geometry + + Show examples of: + - within: The Palace of Westminster (point) in "City of Westminster" (polygon) + - intersect: thames (line) crossing London (polygon) +--> +<slide>slides/mongodb/geo-within.xml</slide> +<slide>slides/mongodb/geo-within-intersects-explanation.xml</slide> +<slide>slides/mongodb/geo-within-1.xml</slide> +<slide>slides/mongodb/geo-within-2.xml</slide> + +<slide>slides/mongodb/geo-intersects.xml</slide> +<slide>slides/mongodb/geo-intersects-1.xml</slide> + + +<!-- +Without index: + $near + Look at every point + Sort by distance + Very slow, so requires an index. + $geoWithin + Look at every document + Is it within the query polygon? + Order is arbitrary + $geoIntersects + Look at every document + Does it intersect with the query geometry? + Order is arbitrary +--> +<!-- AGGREGATION: + + - show tube stations per borough + - show pubs by borough + +http://docs.mongodb.org/manual/reference/aggregation/#stage._S_geoNear + +- distance is important +- $geoNear in aggregation can't deal with more than one 2dsphere index +- spherical option is *required* when using a 2dsphere index +--> +<slide>slides/mongodb/geo-aggregation.xml</slide> +<slide>slides/mongodb/geo-aggregation2.xml</slide> + +<!-- SHOW EXAMPLE OF: + - MULTIPLE GEO FIELDS + - compound keys with: + normal first, geo second + geo first, normal second +--> +<slide>slides/mongodb/geo-indexes.xml</slide> + +<slide>slides/mongodb/summary.xml</slide> + +<slide>slides/mongodb/resources.xml</slide> + +</presentation> diff --git a/mongo-osm-montreal-evening.xml b/mongo-osm-montreal-evening.xml index 58af8c7..822a332 100644 --- a/mongo-osm-montreal-evening.xml +++ b/mongo-osm-montreal-evening.xml @@ -8,7 +8,7 @@ <speaker>Derick Rethans</speaker> <email>derick@10gen.com</email> <twitter>derickr</twitter> -<joindin></joindin> +<joindin>http://derickrethans.nl/talks/mongo-osm-montreal-evening</joindin> <slide>slides/mongodb/evening-welcome.xml</slide> <slide>slides/mongodb/program-yul-evening.xml</slide> diff --git a/slides/mongodb/cells-coverings.xml b/slides/mongodb/cells-coverings.xml new file mode 100644 index 0000000..cf7ed2a --- /dev/null +++ b/slides/mongodb/cells-coverings.xml @@ -0,0 +1,9 @@ +<slide> +<title>Coverings</title> + +<list> + <bullet>The last slide had a very coarse grid overlaid on the United Kingdom</bullet> + <bullet>Coverings are a set of cells that cover a geometry</bullet> + <bullet>Coverings are the basis of the 2dsphere index</bullet> +</list> +</slide> diff --git a/slides/mongodb/cells-level10-example-london-1.xml b/slides/mongodb/cells-level10-example-london-1.xml new file mode 100644 index 0000000..3387cc6 --- /dev/null +++ b/slides/mongodb/cells-level10-example-london-1.xml @@ -0,0 +1,7 @@ +<slide> +<title>Cells for a point</title> + +<image filename="ldn-point.png"/> + +<blurb align="center">amenity=toilets</blurb> +</slide> diff --git a/slides/mongodb/cells-level10-example-london-2.xml b/slides/mongodb/cells-level10-example-london-2.xml new file mode 100644 index 0000000..b635151 --- /dev/null +++ b/slides/mongodb/cells-level10-example-london-2.xml @@ -0,0 +1,7 @@ +<slide> +<title>Cells for a line</title> + +<image filename="ldn-line.png"/> + +<blurb align="center">highway=primary<br/>name=Trafalgar Square</blurb> +</slide> diff --git a/slides/mongodb/cells-level10-example-london-3.xml b/slides/mongodb/cells-level10-example-london-3.xml new file mode 100644 index 0000000..b41c8b4 --- /dev/null +++ b/slides/mongodb/cells-level10-example-london-3.xml @@ -0,0 +1,7 @@ +<slide> +<title>Cells for a polygon</title> + +<image filename="ldn-polygon.png"/> + +<blurb align="center">highway=pedestrian<br/>name=Trafalgar Square<br/>area=yes</blurb> +</slide> diff --git a/slides/mongodb/cells-level3-example-uk-1.xml b/slides/mongodb/cells-level3-example-uk-1.xml new file mode 100644 index 0000000..b5e67ba --- /dev/null +++ b/slides/mongodb/cells-level3-example-uk-1.xml @@ -0,0 +1,5 @@ +<slide> +<title>Coarse grid over the British Isles</title> + +<image filename="uk-grid-0.png"/> +</slide> diff --git a/slides/mongodb/cells-level3-example-uk-2.xml b/slides/mongodb/cells-level3-example-uk-2.xml new file mode 100644 index 0000000..efc526a --- /dev/null +++ b/slides/mongodb/cells-level3-example-uk-2.xml @@ -0,0 +1,5 @@ +<slide> +<title>Coarse grid with cells covering the UK</title> + +<image filename="uk-grid-1.png"/> +</slide> diff --git a/slides/mongodb/cells-level3-example-uk-3.xml b/slides/mongodb/cells-level3-example-uk-3.xml new file mode 100644 index 0000000..04b6e42 --- /dev/null +++ b/slides/mongodb/cells-level3-example-uk-3.xml @@ -0,0 +1,5 @@ +<slide> +<title>Coarse grid with cells covering the UK and Wales</title> + +<image filename="uk-grid-2.png"/> +</slide> diff --git a/slides/mongodb/cells-level3-example-uk-4.xml b/slides/mongodb/cells-level3-example-uk-4.xml new file mode 100644 index 0000000..d509963 --- /dev/null +++ b/slides/mongodb/cells-level3-example-uk-4.xml @@ -0,0 +1,5 @@ +<slide> +<title>Refined grid with cells covering Wales</title> + +<image filename="uk-grid-3.png"/> +</slide> diff --git a/slides/mongodb/cells.xml b/slides/mongodb/cells.xml new file mode 100644 index 0000000..5103664 --- /dev/null +++ b/slides/mongodb/cells.xml @@ -0,0 +1,16 @@ +<slide> +<title>Cells</title> + +<list> + <bullet> + We divide the surface of the earth into cells + <list> + <bullet>A library called S2 from Google does the hard work</bullet> + </list> + </bullet> + <bullet>Cells have a level which define the size of the cell</bullet> + <bullet>S2 provides 31 levels</bullet> + <bullet>The higher the level, the smaller the cell, and therefore the more needed to cover the earth</bullet> + <bullet>By default, we use all levels between 500m on a side and 100km on a side</bullet> +</list> +</slide> diff --git a/slides/mongodb/charingcross.png b/slides/mongodb/charingcross.png new file mode 100644 index 0000000..ebdb369 Binary files /dev/null and b/slides/mongodb/charingcross.png differ diff --git a/slides/mongodb/few-words-about-osm.xml b/slides/mongodb/few-words-about-osm.xml new file mode 100644 index 0000000..0304170 --- /dev/null +++ b/slides/mongodb/few-words-about-osm.xml @@ -0,0 +1,12 @@ +<slide> +<title>About the example data-set</title> + +<list> + <bullet>The examples in this talk use data from OpenStreetMap</bullet> + <bullet>OpenStreetMap is a free worldwide map, created through crowdsourcing</bullet> + <bullet>The data is free to download and use under its open license.</bullet> + <bullet>It's sort of a WikiPedia for map data</bullet> +</list> +<break lines="4"/> +<image filename="../map/osm.png"/> +</slide> diff --git a/slides/mongodb/geo-2.2.xml b/slides/mongodb/geo-2.2.xml new file mode 100644 index 0000000..ac8b027 --- /dev/null +++ b/slides/mongodb/geo-2.2.xml @@ -0,0 +1,18 @@ +<slide> +<title>Geo features in MongoDB 2.2</title> + +<list> + <bullet>Planar with occasional spherical distance + <list> + <bullet>%$nearSphere%, %$centerSphere%</bullet> + <bullet>Limited spherical behaviour (wrapping)</bullet> + </list> + </bullet> + <bullet>Indexes only points</bullet> + <bullet>%$near(Sphere)% finds Points near a point</bullet> + <bullet>%$within% finds points within a circle or a polygon</bullet> + <bullet>Index required for everything</bullet> + <bullet>Index type: 2d</bullet> +</list> + +</slide> diff --git a/slides/mongodb/geo-aggregation.xml b/slides/mongodb/geo-aggregation.xml new file mode 100644 index 0000000..749c0f2 --- /dev/null +++ b/slides/mongodb/geo-aggregation.xml @@ -0,0 +1,13 @@ +<slide> +<title>Aggregation: $geoNear</title> + +<list> + <bullet>MongoDB's aggregation framework has as %$geoNear% pipeline operator</bullet> + <bullet>Also adds the %distance% as a new field to the document</bullet> +</list> +<break /> +<list> + <bullet>Has to be the first operator in the pipeline</bullet> + <bullet>Only works if there is *one* 2dsphere index</bullet> +</list> +</slide> diff --git a/slides/mongodb/geo-aggregation2-php.xml b/slides/mongodb/geo-aggregation2-php.xml new file mode 100644 index 0000000..ecad8a7 --- /dev/null +++ b/slides/mongodb/geo-aggregation2-php.xml @@ -0,0 +1,92 @@ +<slide> +<title>Aggregation: $geoNear example</title> + +<image filename="pubs-distance.png" align="right"/> + +<div effect="fade-out"> +<example inline="1"><![CDATA[ +$center = new GeoJSONPoint( + (float) $_GET['lon'], + (float) $_GET['lat'] +); +$maxDist = 500; // in meters +$rEarth = 6371000; + +$res = $c->aggregate( array( + '$geoNear' => array( + 'near' => $center->p, + 'distanceField' => 'distance', + 'distanceMultiplier' => $rEarth, + 'maxDistance' => $maxDist / $rEarth, + 'spherical' => true, + 'query' => array( + '$or' => array( + array( TAGS => 'amenity=pub' ), + array( TAGS => 'amenity=bar' ) + ) + ), + ) +) ); +]]></example> +</div> + +<div effect="fade-in-out"> +<example inline="1"><![CDATA[ +$center = new GeoJSONPoint( + (float) $_GET['lon'], + (float) $_GET['lat'] +); +$maxDist = 500; // in meters +$rEarth = 6371000; + +$res = $c->aggregate( array( + |ff0000|'$geoNear' => array(| + |ff0000|'near' => $center->p,| + 'distanceField' => 'distance', + 'distanceMultiplier' => $rEarth, + 'maxDistance' => $maxDist / $rEarth, + |ff0000|'spherical' => true,| + |ff0000|'query' => array(| + |ff0000|'$or' => array(| + |ff0000|array( TAGS => 'amenity=pub' ),| + |ff0000|array( TAGS => 'amenity=bar' )| + |ff0000|)| + |ff0000|),| + |ff0000|)| +) ); +]]></example> +</div> + +<div effect="fade-in-out"> +<example inline="1"><![CDATA[ +$center = new GeoJSONPoint( + (float) $_GET['lon'], + (float) $_GET['lat'] +); + +|ff0000|$maxDist = 500; // in meters| +|ff0000|$rEarth = 6371000;| + +$res = $c->aggregate( array( + '$geoNear' => array( + 'near' => $center->p, + |ff0000|'distanceField' => 'distance',| + |ff0000|'distanceMultiplier' => $rEarth,| + |ff0000|'maxDistance' => $maxDist / $rEarth,| + 'spherical' => true, + 'query' => array( + '$or' => array( + array( TAGS => 'amenity=pub' ), + array( TAGS => 'amenity=bar' ) + ) + ), + ) +) ); +]]></example> +</div> + +<div effect="fade-in-out"> +<example inline="1"><![CDATA[ +]]></example> +</div> +</slide> diff --git a/slides/mongodb/geo-aggregation2.xml b/slides/mongodb/geo-aggregation2.xml new file mode 100644 index 0000000..1ac9248 --- /dev/null +++ b/slides/mongodb/geo-aggregation2.xml @@ -0,0 +1,98 @@ +<slide> +<title>Aggregation: $geoNear example</title> + +<image filename="pubs-distance.png" align="right"/> + +<div effect="fade-out"> +<example inline="1"><![CDATA[ +maxDist = 500; +rEarth = 6371000; + +res = db.poiConcat.aggregate( [ { + '$geoNear' : { + 'near' : [ -0.122055, 51.514562 ], + 'distanceField' : 'distance', + 'distanceMultiplier' : rEarth, + 'maxDistance' : maxDist / rEarth, + 'spherical' : true, + 'query' : { + '$or' : [ + { ts: 'amenity=pub' }, + { ts: 'amenity=bar' }, + ] + } + } +} ] ) +]]></example> +</div> + +<div effect="fade-in-out"> +<example inline="1"><![CDATA[ +maxDist = 500; +rEarth = 6371000; + +res = db.poiConcat.aggregate( [ { + |ff0000|'$geoNear' : {| + |ff0000|'near' : [ -0.122055, 51.514562 ],| + 'distanceField' : 'distance', + 'distanceMultiplier' : rEarth, + 'maxDistance' : maxDist / rEarth, + |ff0000|'spherical' : true,| + |ff0000|'query' : {| + |ff0000|'$or' : [| + |ff0000|{ ts: 'amenity=pub' },| + |ff0000|{ ts: 'amenity=bar' },| + |ff0000|]| + |ff0000|}| + |ff0000|} | +} ] ) +]]></example> +</div> + +<div effect="fade-in-out"> +<example inline="1"><![CDATA[ +|ff0000|maxDist = 500;| +|ff0000|rEarth = 6371000;| + +res = db.poiConcat.aggregate( [ { + '$geoNear' : { + 'near' : [ -0.122055, 51.514562 ], + |ff0000|'distanceField' : 'distance',| + |ff0000|'distanceMultiplier' : rEarth,| + |ff0000|'maxDistance' : maxDist / rEarth,| + 'spherical' : true, + 'query' : { + '$or' : [ + { ts: 'amenity=pub' }, + { ts: 'amenity=bar' }, + ] + } + } +} ] ) +]]></example> +</div> + +<div effect="fade-in"> +<example inline="1"><![CDATA[ +> res.result[0] +{ + "_id" : "n312156665", + "ty" : NumberLong(1), + "l" : { + "type" : "Point", + "coordinates" : [ + -0.121732, + 51.5145794 + ] + }, + "ts" : [ + "amenity=pub", + "name=The Prince of Wales", + "toilets=yes", + "toilets:access=customers" + ], + |ff0000|"distance" : 22.432289888830912| +} +]]></example> +</div> +</slide> diff --git a/slides/mongodb/geo-in-2.4.xml b/slides/mongodb/geo-in-2.4.xml new file mode 100644 index 0000000..8a9f8a0 --- /dev/null +++ b/slides/mongodb/geo-in-2.4.xml @@ -0,0 +1,22 @@ +<slide> +<title>Geo Operators</title> + +<blurb>%$near%</blurb> +<list> + <bullet>find stuff near a point</bullet> + <bullet>index required</bullet> +</list> + +<blurb>%$geoWithin%</blurb> +<list> + <bullet>find stuff within a polygon/circle</bullet> + <bullet>index *not* required</bullet> +</list> + +<blurb>%$geoIntersects%</blurb> +<list> + <bullet>find stuff that intersects with other stuff</bullet> + <bullet>index *not* required</bullet> +</list> + +</slide> diff --git a/slides/mongodb/geo-indexes.xml b/slides/mongodb/geo-indexes.xml new file mode 100644 index 0000000..a0a8fa9 --- /dev/null +++ b/slides/mongodb/geo-indexes.xml @@ -0,0 +1,39 @@ +<slide> +<title>Indexes with $geoWithin</title> + +<image filename="geo-within-index.png" align="right"/> +<example> +db.poiConcat.find( { + l: { + $geoWithin: { $geometry: { + type: "Polygon", + coordinates: [[ + [-0.1531, 51.5341], [-0.1346, 51.5341], + [-0.1346, 51.5437], [-0.1531, 51.5437], + [-0.1531, 51.5341] + ]] + } }, + }, + ts: "amenity=pub" +} ).explain(); +</example> + +<div effect="fade-in-out"> + <blurb>*No index:*<br/> BasicCursor, n: 40, nscannedObjects: 2802711, millis: 1246</blurb> +</div> +<div effect="fade-in"> + <blurb>*ensureIndex( { ts: 1 } )*<br/>BtreeCursor ts_1, n: 40, nscannedObjects: 3326, millis: 46</blurb> +</div> +<div effect="fade-in-out"> + <blurb>*ensureIndex( { l: '2dsphere' } )*<br/>S2Cursor, n: 40, nscannedObjects: 196884, millis: 257</blurb> +</div> +<div effect="fade-in"> + <blurb>*ensureIndex( { ts: 1} )* &amp;&amp; *ensureIndex( { l: '2dsphere' } )*<br/>S2Cursor, n: 40, nscannedObjects: 196884, millis: 256</blurb> +</div> +<div effect="fade-in-out"> + <blurb>*ensureIndex( { l: '2dsphere', ts: 1 } )*<br/>S2Cursor, n: 40, nscannedObjects: 523, millis: 8</blurb> +</div> +<div effect="fade-in"> + <blurb>*ensureIndex( { ts: 1, l: '2dsphere' } )*<br/>S2Cursor, n: 40, nscannedObjects: 523, millis: 8</blurb> +</div> +</slide> diff --git a/slides/mongodb/geo-intersects-1.xml b/slides/mongodb/geo-intersects-1.xml new file mode 100644 index 0000000..3085673 --- /dev/null +++ b/slides/mongodb/geo-intersects-1.xml @@ -0,0 +1,5 @@ +<slide> +<title>$geoIntersects - example</title> + +<image filename="intersects-1.png"/> +</slide> diff --git a/slides/mongodb/geo-intersects.xml b/slides/mongodb/geo-intersects.xml new file mode 100644 index 0000000..d056466 --- /dev/null +++ b/slides/mongodb/geo-intersects.xml @@ -0,0 +1,37 @@ +<slide> +<title>Example with $geoIntersects</title> + +<image filename="charingcross.png" align="right"/> + +<example inline="1"> +building = db.poiConcat.findOne( { + _id: "w30734457" +} ); + +db.poiConcat.find( { + l: { + *$geoIntersects: {* + *$geometry: building.l* + *}* + }, + ts: { + $exists: true + } +} ); +</example> + +<example inline="1"> +{ "_id" : "w5059478", "ts" : [ "branch=Charing Cross", "electrified=rail", "frequency=0", "gauge=1435", "history=Retrieved from v43", "layer=-3", "line=Northern", "loading_gauge=deep-tube", "name=Northern Line (Charing Cross Branch) Southbound", "network=London Underground", "oneway=yes", "railway=subway", "tunnel=yes", "voltage=630" ] } +{ "_id" : "w139389296", "ts" : [ "branch=Charing Cross", "electrified=rail", "frequency=10", "gauge=1435", "layer=-2", "line=Northern", "loading_gauge=deep-tube", "name=Northern Line (Charing Cross Branch)", "network=London Underground", "oneway=yes", "railway=subway", "tunnel=yes", "voltage=630" ] } +{ "_id" : "n595696911", "ts" : [ "disused=yes", "disused:amenity=bar", "name=Kudos", "toilets=yes", "toilets:access=customers" ] } +{ "_id" : "n595696974", "ts" : [ "amenity=cafe", "name=Costa", "wheelchair=yes" ] } +{ "_id" : "n653124873", "ts" : [ "addr:city=London", "addr:housenumber=441", "addr:street=Strand", "operator=Paperchase", "phone=020 7497 2797", "postal_code=WC2R 0QU", "shop=stationery", "website=http://www.paperchase.co.uk/london/strand/stry/wc2r0qr/" ] } +{ "_id" : "n1163880380", "ts" : [ "addr:housenumber=430", "addr:street=Strand", "name=Ryman", "phone=+44 20 7240 4408", "postal_code=WC2R 0QN", "shop=stationery", "website=http://www.ryman.co.uk/store-finder/branches/branch/?storeid=1037", "wheelchair=limited" ] } +{ "_id" : "n1571982051", "ts" : [ "name=Charing Cross", "railway=subway_entrance", "source:name=survey", "source:railway=survey" ] } +{ "_id" : "n1571982070", "ts" : [ "name=Charing Cross", "railway=subway_entrance", "source:name=survey", "source:railway=survey", "wheelchair=no" ] } +{ "_id" : "n2066862842", "ts" : [ "addr:housenumber=440", "addr:street=Strand", "amenity=bank", "name=Coutts &amp; Co", "phone=+44 2077 531000", "postal_code=WC2R 0QS", "website=http://www.coutts.com/locations/london-strand/" ] } +{ "_id" : "w166702178", "ts" : [ "layer=-3", "line=Jubilee", "name=Jubilee Line (disused)", "network=London Underground", "oneway=yes", "railway=disused", "tunnel=yes" ] } +{ "_id" : "w166707824", "ts" : [ "layer=-2", "name=Northern Line Southbound", "railway=platform" ] } +{ "_id" : "w166707825", "ts" : [ "layer=-2", "name=Northern Line Northbound", "railway=platform" ] } +</example> +</slide> diff --git a/slides/mongodb/geo-near-explanation-0.xml b/slides/mongodb/geo-near-explanation-0.xml new file mode 100644 index 0000000..9deb25c --- /dev/null +++ b/slides/mongodb/geo-near-explanation-0.xml @@ -0,0 +1,11 @@ +<slide> +<title>$near and cells</title> + +<list> + <bullet>Starts from a point</bullet> + <bullet>Looks at concentric donuts from that point</bullet> + <bullet>Want to look at documents within the donut</bullet> + <bullet>If distance from query point to document is within the donut, output</bullet> + <bullet>Adapts size of the donut as needed</bullet> +</list> +</slide> diff --git a/slides/mongodb/geo-near-explanation-1.xml b/slides/mongodb/geo-near-explanation-1.xml new file mode 100644 index 0000000..eed3f94 --- /dev/null +++ b/slides/mongodb/geo-near-explanation-1.xml @@ -0,0 +1,5 @@ +<slide> +<title>$near - example</title> + +<image filename="near-1.png"/> +</slide> diff --git a/slides/mongodb/geo-near-explanation-2.xml b/slides/mongodb/geo-near-explanation-2.xml new file mode 100644 index 0000000..b0c681f --- /dev/null +++ b/slides/mongodb/geo-near-explanation-2.xml @@ -0,0 +1,5 @@ +<slide> +<title>$near - example</title> + +<image filename="near-2.png"/> +</slide> diff --git a/slides/mongodb/geo-near-explanation-3.xml b/slides/mongodb/geo-near-explanation-3.xml new file mode 100644 index 0000000..3103cec --- /dev/null +++ b/slides/mongodb/geo-near-explanation-3.xml @@ -0,0 +1,5 @@ +<slide> +<title>$near - example</title> + +<image filename="near-3.png"/> +</slide> diff --git a/slides/mongodb/geo-near-explanation-4.xml b/slides/mongodb/geo-near-explanation-4.xml new file mode 100644 index 0000000..ee1114f --- /dev/null +++ b/slides/mongodb/geo-near-explanation-4.xml @@ -0,0 +1,5 @@ +<slide> +<title>$near - example</title> + +<image filename="near-4.png"/> +</slide> diff --git a/slides/mongodb/geo-near-explanation-5.xml b/slides/mongodb/geo-near-explanation-5.xml new file mode 100644 index 0000000..709a672 --- /dev/null +++ b/slides/mongodb/geo-near-explanation-5.xml @@ -0,0 +1,5 @@ +<slide> +<title>$near - example</title> + +<image filename="near-5.png"/> +</slide> diff --git a/slides/mongodb/geo-near-explanation-6.xml b/slides/mongodb/geo-near-explanation-6.xml new file mode 100644 index 0000000..b8ae2d9 --- /dev/null +++ b/slides/mongodb/geo-near-explanation-6.xml @@ -0,0 +1,5 @@ +<slide> +<title>$near - example</title> + +<image filename="near-6.png"/> +</slide> diff --git a/slides/mongodb/geo-near-explanation-7.xml b/slides/mongodb/geo-near-explanation-7.xml new file mode 100644 index 0000000..a4abf67 --- /dev/null +++ b/slides/mongodb/geo-near-explanation-7.xml @@ -0,0 +1,5 @@ +<slide> +<title>$near - example</title> + +<image filename="near-7.png"/> +</slide> diff --git a/slides/mongodb/geo-near.xml b/slides/mongodb/geo-near.xml new file mode 100644 index 0000000..a22113f --- /dev/null +++ b/slides/mongodb/geo-near.xml @@ -0,0 +1,37 @@ +<slide> +<title>Example with $near</title> + +<image filename="near-pub.png" align="right"/> + +<example inline="1"> +db.poiConcat.find( { + ts: "amenity=pub", + l: { + *$near: {* + *$geometry: {* + *type: 'Point',* + *coordinates: [ -0.1204, 51.5168 ]* + *},* + *$maxDistance: 500* + *}* + } +} ).limit(5).pretty(); +</example> + +<example> +{ + "_id" : "n26848690", + "l" : { + "type" : "Point", + "coordinates" : [ -0.119473, 51.516787 ] + }, + "ts" : [ + "addr:housenumber=64-68", + "addr:street=Kingsway", + "amenity=pub", + "name=The Shakespeare's Head", + "wifi=free" + ] +} +</example> +</slide> diff --git a/slides/mongodb/geo-within-1.xml b/slides/mongodb/geo-within-1.xml new file mode 100644 index 0000000..aacbcd1 --- /dev/null +++ b/slides/mongodb/geo-within-1.xml @@ -0,0 +1,5 @@ +<slide> +<title>$geoWithin - example</title> + +<image filename="within-1.png"/> +</slide> diff --git a/slides/mongodb/geo-within-2.xml b/slides/mongodb/geo-within-2.xml new file mode 100644 index 0000000..89d52c7 --- /dev/null +++ b/slides/mongodb/geo-within-2.xml @@ -0,0 +1,5 @@ +<slide> +<title>$geoWithin - example</title> + +<image filename="within-2.png"/> +</slide> diff --git a/slides/mongodb/geo-within-index.png b/slides/mongodb/geo-within-index.png new file mode 100644 index 0000000..cbc4ede Binary files /dev/null and b/slides/mongodb/geo-within-index.png differ diff --git a/slides/mongodb/geo-within-intersects-explanation.xml b/slides/mongodb/geo-within-intersects-explanation.xml new file mode 100644 index 0000000..227edb7 --- /dev/null +++ b/slides/mongodb/geo-within-intersects-explanation.xml @@ -0,0 +1,15 @@ +<slide> +<title>$geoWithin/$geoIntersects and cells</title> + +<list> + <bullet>Generate a covering for geometry in query</bullet> + <bullet>Look at all points in all overlapping cells + <list> + <bullet>Cells may be larger or smaller than our covering</bullet> + <bullet>Must look at cells that contain our covering</bullet> + <bullet>Must look at cells that we contain</bullet> + </list> + </bullet> + <bullet>See if documents are within or intersect our query geometry</bullet> +</list> +</slide> diff --git a/slides/mongodb/geo-within.xml b/slides/mongodb/geo-within.xml new file mode 100644 index 0000000..13c4221 --- /dev/null +++ b/slides/mongodb/geo-within.xml @@ -0,0 +1,37 @@ +<slide> +<title>Example with $geoWithin</title> + +<image filename="hydepark.png" align="right"/> + +<example inline="1"> +hydepark = db.poiConcat.findOne( { + ts: { $all: [ + "name=Hyde Park", "leisure=park" + ] } +} ); + +db.poiConcat.find( { + *l: { $geoWithin: {* + *$geometry: hydepark.l* + *} },* + ts: "amenity=cafe" +} ); +</example> + +<example inline="1"> +{ + "_id" : "w19851241", + "ty" : NumberLong(2), + "l" : *{* + *"type" : "Polygon",* + *"coordinates" : [* + *[ [ -0.1549378, 51.508331 ], … [ -0.1549378, 51.508331 ] ]* + *]* + *},* + "ts" : [ + "access=yes", "leisure=park", "name=Hyde Park", + "wikipedia=http://en.wikipedia.org/wiki/Hyde_Park,_London" + ] +} +</example> +</slide> diff --git a/slides/mongodb/geojson-line.png b/slides/mongodb/geojson-line.png new file mode 100644 index 0000000..0bef971 Binary files /dev/null and b/slides/mongodb/geojson-line.png differ diff --git a/slides/mongodb/geojson-linestring.xml b/slides/mongodb/geojson-linestring.xml new file mode 100644 index 0000000..badba0d --- /dev/null +++ b/slides/mongodb/geojson-linestring.xml @@ -0,0 +1,31 @@ +<slide> +<title>GeoJSON: LineString</title> + +<image filename="geojson-line.png" align="right" /> + +<example> +{ + "_id" : "w4373934", + "ty" : NumberLong(2), + "l" : { + "type" : "LineString", + "coordinates" : [ + [ -0.1286202, 51.50752 ], + [ -0.1283857, 51.5075115 ], + [ -0.1282389, 51.5075112 ], + [ -0.1278265, 51.5075453 ] + ] + }, + "ts" : [ + "highway=primary", + "lit=yes", + "name=Trafalgar Square", + "oneway=yes", + "postal_code=WC2", + "sidewalk=left" + ] +} + +</example> + +</slide> diff --git a/slides/mongodb/geojson-point.png b/slides/mongodb/geojson-point.png new file mode 100644 index 0000000..d5bcfce Binary files /dev/null and b/slides/mongodb/geojson-point.png differ diff --git a/slides/mongodb/geojson-point.xml b/slides/mongodb/geojson-point.xml new file mode 100644 index 0000000..f5d35b4 --- /dev/null +++ b/slides/mongodb/geojson-point.xml @@ -0,0 +1,26 @@ +<slide> +<title>GeoJSON: Point</title> + +<image filename="geojson-point.png" align="right" /> + +<example> +{ + "_id" : "n356277759", + "ty" : NumberLong(1), + "l" : { + "type" : "Point", + "coordinates" : [ + -0.1607376, + 51.5138662 + ] + }, + "ts" : [ + "amenity=pub", + "food=yes", + "name=The Tyburn", + "operator=wetherspoons", + "real_ale=yes" + ] +} +</example> +</slide> diff --git a/slides/mongodb/geojson-polygon.png b/slides/mongodb/geojson-polygon.png new file mode 100644 index 0000000..919c9c1 Binary files /dev/null and b/slides/mongodb/geojson-polygon.png differ diff --git a/slides/mongodb/geojson-polygon.xml b/slides/mongodb/geojson-polygon.xml new file mode 100644 index 0000000..422d502 --- /dev/null +++ b/slides/mongodb/geojson-polygon.xml @@ -0,0 +1,31 @@ +<slide> +<title>GeoJSON: Polygon</title> + +<image filename="geojson-polygon.png" align="right"/> + +<example> +{ + "_id" : "w161490892", + "ty" : NumberLong(2), + "l" : { + "type" : "Polygon", + "coordinates" : [ + [ + [ -0.1356425, 51.497671 ], + [ -0.1355737, 51.4975662 ], + [ -0.1354639, 51.4975815 ], + [ -0.1354536, 51.497694 ], + [ -0.1356425, 51.497671 ] + ] + ] + }, + "ts" : [ + "amenity=pub", + "building=yes", + "name=The Albert", + "real_ale=yes" + ] +} +</example> + +</slide> diff --git a/slides/mongodb/geojson.xml b/slides/mongodb/geojson.xml new file mode 100644 index 0000000..9e86a9f --- /dev/null +++ b/slides/mongodb/geojson.xml @@ -0,0 +1,20 @@ +<slide> +<title>GeoJson</title> + +<blurb>Example:</blurb> +<example> +{ + loc : { + type : "LineString" , + coordinates : [ [ -0.09, 51.49 ], [ 2.35, 48.86 ] ] + } +} +</example> +<break/> + +<list> + <bullet>GeoJSON is a format for encoding a variety of geographic data structures.</bullet> + <bullet>Used by various other HTML APIs as well: OpenLayers, Leaflet and through GDAL also PostGIS.</bullet> + <bullet>MongoDB supports three sub-formats: Point, LineString, and Polygon.</bullet> +</list> +</slide> diff --git a/slides/mongodb/hydepark.png b/slides/mongodb/hydepark.png new file mode 100644 index 0000000..3588aa9 Binary files /dev/null and b/slides/mongodb/hydepark.png differ diff --git a/slides/mongodb/intersects-1.png b/slides/mongodb/intersects-1.png new file mode 100644 index 0000000..a56a348 Binary files /dev/null and b/slides/mongodb/intersects-1.png differ diff --git a/slides/mongodb/introducing-2dsphere.xml b/slides/mongodb/introducing-2dsphere.xml new file mode 100644 index 0000000..57605c4 --- /dev/null +++ b/slides/mongodb/introducing-2dsphere.xml @@ -0,0 +1,21 @@ +<slide> +<title>MongoDB 2.4: Introducing 2dsphere</title> + +<list> + <bullet>Lines, Polygons and Points can be indexed.</bullet> + + <bullet> + Multiple geo fields can be indexed: + <list> + <bullet>Find me air routes where the start is within 50mi of NYC and the end points is within 50mi of Miami.</bullet> + </list> + </bullet> + <bullet> + Geo field doesn't have to be first indexed field. + <list> + <bullet>Speeds up certain queries a lot.</bullet> + </list> + </bullet> + <bullet>Almost no driver changes needed, since only added new queries.</bullet> +</list> +</slide> diff --git a/slides/mongodb/ldn-line.png b/slides/mongodb/ldn-line.png new file mode 100644 index 0000000..f3dd764 Binary files /dev/null and b/slides/mongodb/ldn-line.png differ diff --git a/slides/mongodb/ldn-point.png b/slides/mongodb/ldn-point.png new file mode 100644 index 0000000..d634df5 Binary files /dev/null and b/slides/mongodb/ldn-point.png differ diff --git a/slides/mongodb/ldn-polygon.png b/slides/mongodb/ldn-polygon.png new file mode 100644 index 0000000..24fc1aa Binary files /dev/null and b/slides/mongodb/ldn-polygon.png differ diff --git a/slides/mongodb/near-1.png b/slides/mongodb/near-1.png new file mode 100644 index 0000000..c9114f1 Binary files /dev/null and b/slides/mongodb/near-1.png differ diff --git a/slides/mongodb/near-2.png b/slides/mongodb/near-2.png new file mode 100644 index 0000000..0201e66 Binary files /dev/null and b/slides/mongodb/near-2.png differ diff --git a/slides/mongodb/near-3.png b/slides/mongodb/near-3.png new file mode 100644 index 0000000..97ae8b7 Binary files /dev/null and b/slides/mongodb/near-3.png differ diff --git a/slides/mongodb/near-4.png b/slides/mongodb/near-4.png new file mode 100644 index 0000000..6b22ebd Binary files /dev/null and b/slides/mongodb/near-4.png differ diff --git a/slides/mongodb/near-5.png b/slides/mongodb/near-5.png new file mode 100644 index 0000000..a06a3b4 Binary files /dev/null and b/slides/mongodb/near-5.png differ diff --git a/slides/mongodb/near-6.png b/slides/mongodb/near-6.png new file mode 100644 index 0000000..a286cc4 Binary files /dev/null and b/slides/mongodb/near-6.png differ diff --git a/slides/mongodb/near-7.png b/slides/mongodb/near-7.png new file mode 100644 index 0000000..8fa544a Binary files /dev/null and b/slides/mongodb/near-7.png differ diff --git a/slides/mongodb/near-pub.png b/slides/mongodb/near-pub.png new file mode 100644 index 0000000..b6db2d9 Binary files /dev/null and b/slides/mongodb/near-pub.png differ diff --git a/slides/mongodb/pubs-distance.png b/slides/mongodb/pubs-distance.png new file mode 100644 index 0000000..a2c6d0b Binary files /dev/null and b/slides/mongodb/pubs-distance.png differ diff --git a/slides/mongodb/resources.xml b/slides/mongodb/resources.xml index 4d133ca..bf3b013 100644 --- a/slides/mongodb/resources.xml +++ b/slides/mongodb/resources.xml @@ -2,7 +2,6 @@ <title>Resources</title> <qrcode>http://derickrethans.nl/talks/:-:talk_id:-:</qrcode> -<break/> <list> <bullet>Slides and Feedback: :-:joindin:-:</bullet> <bullet>Contact me: :-:speaker:-:: @:-:twitter:-:, :-:email:-:</bullet> diff --git a/slides/mongodb/stjamesspark.xcf b/slides/mongodb/stjamesspark.xcf new file mode 100644 index 0000000..cd62ba6 Binary files /dev/null and b/slides/mongodb/stjamesspark.xcf differ diff --git a/slides/mongodb/summary.xml b/slides/mongodb/summary.xml new file mode 100644 index 0000000..df186b8 --- /dev/null +++ b/slides/mongodb/summary.xml @@ -0,0 +1,3 @@ +<slide> +<title>Summary</title> +</slide> diff --git a/slides/mongodb/uk-grid-0.png b/slides/mongodb/uk-grid-0.png new file mode 100644 index 0000000..7531416 Binary files /dev/null and b/slides/mongodb/uk-grid-0.png differ diff --git a/slides/mongodb/uk-grid-1.png b/slides/mongodb/uk-grid-1.png new file mode 100644 index 0000000..58166e6 Binary files /dev/null and b/slides/mongodb/uk-grid-1.png differ diff --git a/slides/mongodb/uk-grid-2.png b/slides/mongodb/uk-grid-2.png new file mode 100644 index 0000000..8cb8108 Binary files /dev/null and b/slides/mongodb/uk-grid-2.png differ diff --git a/slides/mongodb/uk-grid-3.png b/slides/mongodb/uk-grid-3.png new file mode 100644 index 0000000..a7a57b7 Binary files /dev/null and b/slides/mongodb/uk-grid-3.png differ diff --git a/slides/mongodb/what-is-geo.xml b/slides/mongodb/what-is-geo.xml new file mode 100644 index 0000000..7daa915 --- /dev/null +++ b/slides/mongodb/what-is-geo.xml @@ -0,0 +1,7 @@ +<slide> +<title>What is "geo"?</title> + +<list> + <bullet>MongoDB's geo features allow you to index and search based on location</bullet> +</list> +</slide> diff --git a/slides/mongodb/within-1.png b/slides/mongodb/within-1.png new file mode 100644 index 0000000..8d0cb68 Binary files /dev/null and b/slides/mongodb/within-1.png differ diff --git a/slides/mongodb/within-2.png b/slides/mongodb/within-2.png new file mode 100644 index 0000000..14a924f Binary files /dev/null and b/slides/mongodb/within-2.png differ
« previous php.pres (#1874) next »