0
Building Spatial Web Services     with MongoDB + NodeJS in        Less than 30 Minutes      Steven Citron-Pousty      PaaS...
Agenda    •Learn a little spatial    •Load some spatial data into mongo    •Do a query or two    •Repo for today’s code is...
Assumptions    1)You already know that Node.JS + Mongo is like    chocolate and peanut butter    2)You can use the command...
Kind of like Amazon, right? Nope.4
Cook24v on Flickr5
What’s supported?6
There’s more? What’s the catch?•OpenShift is free-as-in-beer & free-as-in-freedom•Three 512 MB RAM / 1 GB storage gears•Ne...
On to spatial!8
Spatial is fun    The spatial functionality Mongo currently has is:    1)Near    2)Containment    All of it is laid out on...
Good to know 1.Assumes coords. are between [-180 and 180) 2.Can handle any 2D coordinates 3.Has methods to handle curvatur...
How to make it work 1) Put your coordinates into an arrary {   loc   :   [   50 , 30 ] } {   loc   :   {   x : 50 , y : 30...
Demo 1.I have a Node.JS app and a mongo instance running, with spatial data and 2D index already created 2.Do some fun spa...
Conclusion 1.Spatial is easy and fun on Mongo 2.You can now build your own Foursquare or other checkin application. 3.You ...
Upcoming SlideShare
Loading in...5
×

Spatial MongoDB, Node.JS, and Express - server-side JS for your application

2,828

Published on

My Spatial presentation at MongoBoulder

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,828
On Slideshare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
17
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Transcript of "Spatial MongoDB, Node.JS, and Express - server-side JS for your application"

  1. 1. Building Spatial Web Services with MongoDB + NodeJS in Less than 30 Minutes Steven Citron-Pousty PaaS Dust Spreader, Red Hat @TheSteve01
  2. 2. Agenda •Learn a little spatial •Load some spatial data into mongo •Do a query or two •Repo for today’s code is here – •https://github.com/openshift/openshift-mongo-node- express-example SIGN UP CODE: mongoboulder2
  3. 3. Assumptions 1)You already know that Node.JS + Mongo is like chocolate and peanut butter 2)You can use the command line 3)You are comfortable with Mongo command line 4)Please ask questions – though since we only have 30 minutes they may have to wait until the end or after the session3
  4. 4. Kind of like Amazon, right? Nope.4
  5. 5. Cook24v on Flickr5
  6. 6. What’s supported?6
  7. 7. There’s more? What’s the catch?•OpenShift is free-as-in-beer & free-as-in-freedom•Three 512 MB RAM / 1 GB storage gears•Need more resources, just ask!•We are really in Developer Preview7
  8. 8. On to spatial!8
  9. 9. Spatial is fun The spatial functionality Mongo currently has is: 1)Near 2)Containment All of it is laid out on two pages: http://docs.mongodb.org/manual/applications/geospatial- indexes/ And http://docs.mongodb.org/manual/core/geospatial- indexes/9
  10. 10. Good to know 1.Assumes coords. are between [-180 and 180) 2.Can handle any 2D coordinates 3.Has methods to handle curvature of the earth (spherical)10
  11. 11. How to make it work 1) Put your coordinates into an arrary { loc : [ 50 , 30 ] } { loc : { x : 50 , y : 30 } } { loc : { foo : 50 , y : 30 } } { loc : { lon : 40.739037, lat: 73.992964 } } If you use spherical make sure to put [lon, lat] 2) Make a 2d index db.places.ensureIndex( { loc : "2d" } ) There is also a Haystack index – buckets the world11
  12. 12. Demo 1.I have a Node.JS app and a mongo instance running, with spatial data and 2D index already created 2.Do some fun spatial and MongoDB work 3.Show you the web services12
  13. 13. Conclusion 1.Spatial is easy and fun on Mongo 2.You can now build your own Foursquare or other checkin application. 3.You can also build your own field data entry system. 4.You can build and deploy your application quickly without having to think about infrastructure. SIGN UP CODE: mongoboulder http://openshift.redhat.com13
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×