com presentations: Geomob talk.: mongo-osm-geomob14.xml slides/mongodb/document.xml slides/mongodb/flat-vs-sphere.xml slides/mongodb/geo-aggregation2.xml slides/mongodb/geo-conclusion.xml slides/mongodb/geo-in-2.4.xml slides/mongodb/geo-near.xml slides/mongodb/geojson.xml slides/mongodb/idx-geo.xml slides/mongodb/what-is-mongodb.xml templates/default/iframe.ezt
[email protected] (Derick Rethans)
| Newsgroups | php.pres |
|---|---|
| Message-ID | <[email protected]> |
Commit: 8407131ac798a2b6cf4d9e273285aaeda832fb4a Author: Derick Rethans <[email protected]> Tue, 16 Sep 2014 16:54:47 +0100 Parents: 562c8c83161a8986677dde18738be1805e3fc7bb Branches: master Link: http://git.php.net/?p=presentations.git;a=commitdiff;h=8407131ac798a2b6cf4d9e273285aaeda832fb4a Log: Geomob talk. Changed paths: A mongo-osm-geomob14.xml M slides/mongodb/document.xml M slides/mongodb/flat-vs-sphere.xml M slides/mongodb/geo-aggregation2.xml A slides/mongodb/geo-conclusion.xml M slides/mongodb/geo-in-2.4.xml M slides/mongodb/geo-near.xml M slides/mongodb/geojson.xml M slides/mongodb/idx-geo.xml M slides/mongodb/what-is-mongodb.xml M templates/default/iframe.ezt
diff_8407131ac798a2b6cf4d9e273285aaeda832fb4a.txt
(text/plain, 9.8 KB)
diff --git a/mongo-osm-geomob14.xml b/mongo-osm-geomob14.xml new file mode 100644 index 0000000..ee647c0 --- /dev/null +++ b/mongo-osm-geomob14.xml @@ -0,0 +1,139 @@ +<?xml version="1.0" encoding="utf-8"?> +<presentation css="10gen-strict.css"> +<topic>MongoDB</topic> +<title>Geospatial MongoDB</title> +<event>ConFoo</event> +<location>London, UK</location> +<lat>51.51065</lat><lon>-0.12160</lon> +<date>September 16th, 2014</date> +<speaker>Derick Rethans</speaker> +<email>[email protected]</email> +<twitter>derickr</twitter> +<joindin></joindin> + +<slide>slides/mongodb/title.xml</slide> + +<slide>slides/mongodb/what-is-mongodb.xml</slide> +<slide>slides/mongodb/collections-documents.xml</slide> +<slide>slides/mongodb/document.xml</slide> + +<!-- DATA STORAGE --> +<!-- + No more [ lon, lat ], but geojson instead + +SAY WHERE ELSE GeoJson is used +--> +<slide>slides/mongodb/idx-geo.xml</slide> +<slide>slides/mongodb/flat-vs-sphere.xml</slide> +<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 +--> + + +<!-- 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> + + +<!-- + 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-1.xml</slide> +<slide>slides/mongodb/geo-within-2.xml</slide> + +<slide>slides/mongodb/geo-intersects.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> + +<slide>slides/mongodb/geo-conclusion.xml</slide> +<slide>slides/mongodb/resources.xml</slide> + +</presentation> diff --git a/slides/mongodb/document.xml b/slides/mongodb/document.xml index 640064b..e7d158a 100644 --- a/slides/mongodb/document.xml +++ b/slides/mongodb/document.xml @@ -3,7 +3,6 @@ <list> <bullet>Can have embedded documents</bullet> - <bullet>Have a unique ID (the %_id% field)</bullet> <bullet>Are *schemaless*</bullet> </list> <break/> diff --git a/slides/mongodb/flat-vs-sphere.xml b/slides/mongodb/flat-vs-sphere.xml index cc2f03a..9b75ba4 100644 --- a/slides/mongodb/flat-vs-sphere.xml +++ b/slides/mongodb/flat-vs-sphere.xml @@ -1,5 +1,5 @@ <slide> <break lines="5"/> <image filename="flat-vs-round.png"/> -<blurb align="center">MongoDB 2.2 vs. MongoDB 2.4</blurb> +<blurb align="center">*2d* index vs. *2dsphere* index</blurb> </slide> diff --git a/slides/mongodb/geo-aggregation2.xml b/slides/mongodb/geo-aggregation2.xml index 9680805..4a9ce25 100644 --- a/slides/mongodb/geo-aggregation2.xml +++ b/slides/mongodb/geo-aggregation2.xml @@ -27,7 +27,7 @@ res = db.poiConcat.aggregate( [ { ]]></example> </div> -<div effect="fade-in-out"> +<div effect="fade-in-out stop"> <example inline="1"><![CDATA[ res = db.poiConcat.aggregate( [ {| |ff0000|'$geoNear' : { | diff --git a/slides/mongodb/geo-conclusion.xml b/slides/mongodb/geo-conclusion.xml new file mode 100644 index 0000000..89627a5 --- /dev/null +++ b/slides/mongodb/geo-conclusion.xml @@ -0,0 +1,11 @@ +<slide> +<title>Conclusion</title> + +<blurb>MongoDB for Geospatial use:</blurb> + +<list> + <bullet>NoSQL database with support for replication and sharding</bullet> + <bullet>GeoJSON support for geospatial data storage</bullet> + <bullet>Can mix geospatial queries with other predicates</bullet> +</list> +</slide> diff --git a/slides/mongodb/geo-in-2.4.xml b/slides/mongodb/geo-in-2.4.xml index 8a9f8a0..d5a0f5b 100644 --- a/slides/mongodb/geo-in-2.4.xml +++ b/slides/mongodb/geo-in-2.4.xml @@ -1,7 +1,7 @@ <slide> <title>Geo Operators</title> -<blurb>%$near%</blurb> +<blurb>%$geoNear%</blurb> <list> <bullet>find stuff near a point</bullet> <bullet>index required</bullet> diff --git a/slides/mongodb/geo-near.xml b/slides/mongodb/geo-near.xml index 5a21375..9fc3f45 100644 --- a/slides/mongodb/geo-near.xml +++ b/slides/mongodb/geo-near.xml @@ -4,7 +4,7 @@ <!-- <image filename="near-pub.png" align="right"/> --> -<iframe align="right" width="500" filename='examples/3angle/?l=fivepubs&zoom=14;&lat=:-:lat:-:&lon=:-:lon:-:'/> +<iframe align="right" width="500" filename='examples/3angle/?l=fivepubs&zoom=17;&lat=:-:lat:-:&lon=:-:lon:-:'/> <example inline="1"> db.poiConcat.find( { diff --git a/slides/mongodb/geojson.xml b/slides/mongodb/geojson.xml index 9e86a9f..6e1198e 100644 --- a/slides/mongodb/geojson.xml +++ b/slides/mongodb/geojson.xml @@ -15,6 +15,6 @@ <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> + <bullet>Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon and GeometryCollection.</bullet> </list> </slide> diff --git a/slides/mongodb/idx-geo.xml b/slides/mongodb/idx-geo.xml index 192778d..a0c56f6 100644 --- a/slides/mongodb/idx-geo.xml +++ b/slides/mongodb/idx-geo.xml @@ -1,30 +1,13 @@ <slide> -<title>Geospatial indexes (2d indexes)</title> +<title>Geospatial indexes</title> <blurb>MongoDB supports indexes on two dimensional fields:</blurb> <example>db.cities.ensureIndex( { location: '2d' } )</example> -<example inline="1"> -db.cities.find( { location: { *$near: [ -0.088, 51.489 ]* } } ); -</example> +<blurb>and</blurb> -<example inline="1"> -db.cities.find( { location: { $near: [ -0.088, 51.489 ] } } ).explain(); -{ - *"cursor" : "GeoSearchCursor",* - "nscanned" : 100, - "nscannedObjects" : 100, - "n" : 100, -... -</example> +<blurb>MongoDB supports indexes on *geospatial fields*:</blurb> +<example>db.cities.ensureIndex( { location: '2dsphere' } )</example> -<list> -<bullet>By default only 100 items, but changable with %limit()%</bullet> -<bullet>You can also add %maxDistance%: -<example inline="1"> -db.cities.find( { location: { $near: [ -0.08, 51.48 ], *$maxDistance: 0.1* } } ); -</example> -</bullet> -</list> </slide> diff --git a/slides/mongodb/what-is-mongodb.xml b/slides/mongodb/what-is-mongodb.xml index a85189e..254dfcf 100644 --- a/slides/mongodb/what-is-mongodb.xml +++ b/slides/mongodb/what-is-mongodb.xml @@ -1,13 +1,14 @@ <slide> -<title>What is mongoDB?</title> +<title>What is MongoDB?</title> <image filename="mongodb.png" align="right"/> <list> - <bullet>mongoDB is a document storage and retrieval engine</bullet> + <bullet>MongoDB is a document storage and retrieval engine</bullet> <bullet>It requires almost no configuration to set-up a high available and high performant cluster of database servers</bullet> <bullet>Each document is stored into a collection, which is stored into a database, which is stored in a database server.</bullet> + <bullet>It is a NoSQL schema-free database</bullet> </list> </slide> diff --git a/templates/default/iframe.ezt b/templates/default/iframe.ezt index 5305ed8..63a96bb 100644 --- a/templates/default/iframe.ezt +++ b/templates/default/iframe.ezt @@ -13,5 +13,5 @@ {/if} {if $attr}<div{if $align} align='{$align}'{/if}>{/if} <iframe style="clear: both; background-color: #fff; margin-left: 9px;" scrolling="no" frameborder="0" width="{$width}" height="{$height}" {if $inline}class='inline' {/if}{if $align}align='{$align}' {/if}src='{$source}'></iframe> -<img src="{$pres->base}{get_attribute( $node, 'image' )}"/> +<!--<img src="{$pres->base}{get_attribute( $node, 'image' )}"/>--> {if $attr}<span class='attribution'>{$attr}</span></div>{/if}