SlideShare a Scribd company logo
Building Spatial Web Services
     with MongoDB + NodeJS in
        Less than 30 Minutes
      Steven Citron-Pousty
      PaaS Dust Spreader, Red Hat
      @TheSteve0


1
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:
              mongoboulder
2
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
    session




3
Kind of like Amazon, right? Nope.




4
Cook24v on Flickr
5
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
•Need more resources, just ask!
•We are really in Developer Preview




7
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 two pages:
    http://docs.mongodb.org/manual/applications/geospatial-
    indexes/

    And

    http://docs.mongodb.org/manual/core/geospatial-
    indexes/
9
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
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 world




11
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 services




12
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.com
13

More Related Content

What's hot (20)

PDF
Spatial script for my JS.Everywhere 2012
Steven Pousty
 
PPTX
Bringing Spatial Love to Your Java Application
MongoDB
 
PPTX
Back to Basics German 3: Einführung in Replica Sets
MongoDB
 
PDF
Restinio - header-only http and websocket server
corehard_by
 
PDF
Redis clustering
Ravi Yasas
 
PDF
Ruby on embedded devices rug::b Aug 2014
Eno Thierbach
 
PPTX
Python Dependencies at Beeswax - BazelCon 2019 Lightning Talk - Ron Rothman
Ron Rothman
 
PDF
GCE NFS HA
Simon Su
 
PDF
Cloud Firestore – From JSON Deserialization to Object Document Mapping (ODM)
Minh Dao
 
PDF
Build, Ship, and Run Any App, Anywhere using Docker
Rahulkrishnan R A
 
PDF
Node36
beshoy semsem
 
PDF
faastCrystal
Sachirou Inoue
 
PDF
Introduction to Hadoop - FinistJug
David Morin
 
PDF
今日から始めるPlan 9 from Bell Labs
Ryousei Takano
 
PPTX
Highload осень 2012 лекция 8
Technopark
 
PPTX
nodester Architecture overview & roadmap
wearefractal
 
PPTX
Nodester Architecture overview & roadmap
cmatthieu
 
PDF
Mashup your life with Yahoo Pipes
Cristiano Betta
 
PPTX
Geek Sync | Using PowerShell with Python and SQL Server
IDERA Software
 
PDF
BOSH deploys distributed systems, and Diego runs any containers
Benjamin Gandon
 
Spatial script for my JS.Everywhere 2012
Steven Pousty
 
Bringing Spatial Love to Your Java Application
MongoDB
 
Back to Basics German 3: Einführung in Replica Sets
MongoDB
 
Restinio - header-only http and websocket server
corehard_by
 
Redis clustering
Ravi Yasas
 
Ruby on embedded devices rug::b Aug 2014
Eno Thierbach
 
Python Dependencies at Beeswax - BazelCon 2019 Lightning Talk - Ron Rothman
Ron Rothman
 
GCE NFS HA
Simon Su
 
Cloud Firestore – From JSON Deserialization to Object Document Mapping (ODM)
Minh Dao
 
Build, Ship, and Run Any App, Anywhere using Docker
Rahulkrishnan R A
 
faastCrystal
Sachirou Inoue
 
Introduction to Hadoop - FinistJug
David Morin
 
今日から始めるPlan 9 from Bell Labs
Ryousei Takano
 
Highload осень 2012 лекция 8
Technopark
 
nodester Architecture overview & roadmap
wearefractal
 
Nodester Architecture overview & roadmap
cmatthieu
 
Mashup your life with Yahoo Pipes
Cristiano Betta
 
Geek Sync | Using PowerShell with Python and SQL Server
IDERA Software
 
BOSH deploys distributed systems, and Diego runs any containers
Benjamin Gandon
 

Viewers also liked (19)

ODT
Spatial script for MongoBoulder
Steven Pousty
 
PDF
Introduction to PaaS for application developers
Steven Pousty
 
PDF
London Cloud Summit 2014 - raising the tide: getting developers in the cloud
Steven Pousty
 
PPTX
APPLICATIONS AND CONTAINERS AT SCALE: OpenShift + Kubernetes + Docker
Steven Pousty
 
PPT
Workshop For pycon13
Steven Pousty
 
PDF
Spatial script for CIMA
Steven Pousty
 
PDF
Open shift intro for Philly PUG
Steven Pousty
 
PPTX
Monkigras - dropping science on your developer ecosystem
Steven Pousty
 
ODP
Build a PaaS with OpenShift Origin
Steven Pousty
 
PDF
Express: the web server for node.js
Eugene Lazutkin
 
PDF
Node.js and express
JoaquimSerafim
 
PPTX
Ultimate Node.js countdown: the coolest Application Express examples
Alan Arentsen
 
PDF
Node.js with express
javakidxxx
 
PDF
Node.js with Express
Gergely Németh
 
PDF
Introduction to Node.JS Express
Eueung Mulyana
 
PPTX
Node.js Express
Eyal Vardi
 
PPTX
The SEAN stack - Build Web Apps With Salesforce, Express, Angular and Node.js
Shashank Srivatsavaya (ShashForce)
 
PDF
Create Restful Web Application With Node.js Express Framework
Edureka!
 
PPTX
Node.js and express
Sunny Sharma
 
Spatial script for MongoBoulder
Steven Pousty
 
Introduction to PaaS for application developers
Steven Pousty
 
London Cloud Summit 2014 - raising the tide: getting developers in the cloud
Steven Pousty
 
APPLICATIONS AND CONTAINERS AT SCALE: OpenShift + Kubernetes + Docker
Steven Pousty
 
Workshop For pycon13
Steven Pousty
 
Spatial script for CIMA
Steven Pousty
 
Open shift intro for Philly PUG
Steven Pousty
 
Monkigras - dropping science on your developer ecosystem
Steven Pousty
 
Build a PaaS with OpenShift Origin
Steven Pousty
 
Express: the web server for node.js
Eugene Lazutkin
 
Node.js and express
JoaquimSerafim
 
Ultimate Node.js countdown: the coolest Application Express examples
Alan Arentsen
 
Node.js with express
javakidxxx
 
Node.js with Express
Gergely Németh
 
Introduction to Node.JS Express
Eueung Mulyana
 
Node.js Express
Eyal Vardi
 
The SEAN stack - Build Web Apps With Salesforce, Express, Angular and Node.js
Shashank Srivatsavaya (ShashForce)
 
Create Restful Web Application With Node.js Express Framework
Edureka!
 
Node.js and express
Sunny Sharma
 
Ad

Similar to Spatial MongoDB, Node.JS, and Express - server-side JS for your application (20)

PDF
Mongo db bangalore
MongoDB
 
PDF
Social IRC bots in the Cloud with OpenShift - Mongo London presentation by Ma...
OpenShift Origin
 
PDF
Bringing spatial love to your python application
Shekhar Gulati
 
PDF
Silicon Valley Code Camp 2014 - Advanced MongoDB
Daniel Coupal
 
PDF
Philadelphia MongoDB User Group - Your First MongoDB Application
Michael Lynn
 
PDF
Building Social IRC Bots with Node.js and MongoDB
MongoDB
 
PPT
MongoDB Pros and Cons
johnrjenson
 
PDF
New paradigms
Borja A. Espejo García
 
PPTX
Geoindexing with MongoDB
leafnode
 
PDF
How to use MongoDB with CakePHP
ichikaway
 
KEY
MongoDB on CloudFoundry
Yohei Sasaki
 
KEY
MongoDB on CloudFoundry
Yohei Sasaki
 
PDF
Java(ee) mongo db applications in the cloud
Shekhar Gulati
 
PDF
Mongo db first steps with csharp
Serdar Buyuktemiz
 
PPTX
Back to Basics Spanish 4 Introduction to sharding
MongoDB
 
PDF
Introduction to using MongoDB with Ruby
Jonathan Holloway
 
PDF
Scaling with mongo db (with notes)
emiltamas
 
PDF
Accra MongoDB User Group
MongoDB
 
PDF
MongoDB and the MEAN Stack
MongoDB
 
PDF
MongoDB Days Silicon Valley: Winning the Dreamforce Hackathon with MongoDB
MongoDB
 
Mongo db bangalore
MongoDB
 
Social IRC bots in the Cloud with OpenShift - Mongo London presentation by Ma...
OpenShift Origin
 
Bringing spatial love to your python application
Shekhar Gulati
 
Silicon Valley Code Camp 2014 - Advanced MongoDB
Daniel Coupal
 
Philadelphia MongoDB User Group - Your First MongoDB Application
Michael Lynn
 
Building Social IRC Bots with Node.js and MongoDB
MongoDB
 
MongoDB Pros and Cons
johnrjenson
 
Geoindexing with MongoDB
leafnode
 
How to use MongoDB with CakePHP
ichikaway
 
MongoDB on CloudFoundry
Yohei Sasaki
 
MongoDB on CloudFoundry
Yohei Sasaki
 
Java(ee) mongo db applications in the cloud
Shekhar Gulati
 
Mongo db first steps with csharp
Serdar Buyuktemiz
 
Back to Basics Spanish 4 Introduction to sharding
MongoDB
 
Introduction to using MongoDB with Ruby
Jonathan Holloway
 
Scaling with mongo db (with notes)
emiltamas
 
Accra MongoDB User Group
MongoDB
 
MongoDB and the MEAN Stack
MongoDB
 
MongoDB Days Silicon Valley: Winning the Dreamforce Hackathon with MongoDB
MongoDB
 
Ad

More from Steven Pousty (7)

PDF
Spatial script for Spatial mongo for PHP and Zend
Steven Pousty
 
PPTX
Dropping Science on Your Developer Ecosystem - lessons from Ecosystem Management
Steven Pousty
 
PPT
Open shift intro for Philly PUG
Steven Pousty
 
PDF
Script for Spatial Mongo
Steven Pousty
 
PPTX
deCarta at BAPI
Steven Pousty
 
PPT
LinuxFest NW - Using Postgis To Add Some Spatial Flavor To Your App
Steven Pousty
 
PPT
Using PostGIS To Add Some Spatial Flavor To Your Application
Steven Pousty
 
Spatial script for Spatial mongo for PHP and Zend
Steven Pousty
 
Dropping Science on Your Developer Ecosystem - lessons from Ecosystem Management
Steven Pousty
 
Open shift intro for Philly PUG
Steven Pousty
 
Script for Spatial Mongo
Steven Pousty
 
deCarta at BAPI
Steven Pousty
 
LinuxFest NW - Using Postgis To Add Some Spatial Flavor To Your App
Steven Pousty
 
Using PostGIS To Add Some Spatial Flavor To Your Application
Steven Pousty
 

Recently uploaded (20)

DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
PDF
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
PDF
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PDF
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
PDF
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
PDF
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PPTX
Digital Circuits, important subject in CS
contactparinay1
 
PPT
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
PPTX
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
Digital Circuits, important subject in CS
contactparinay1
 
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 

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

  • 1. Building Spatial Web Services with MongoDB + NodeJS in Less than 30 Minutes Steven Citron-Pousty PaaS Dust Spreader, Red Hat @TheSteve0 1
  • 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: mongoboulder 2
  • 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 session 3
  • 4. Kind of like Amazon, right? Nope. 4
  • 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 Preview 7
  • 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. 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. 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 world 11
  • 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 services 12
  • 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.com 13