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

PDF
MongoSF - Spatial MongoDB in OpenShift - script file
PDF
Script for the geomeetup presentation
PPT
Mongo sf spatialmongo
PPTX
Spatial mongo for PHP and Zend
PPTX
Spatial Mongo and Node.JS on Openshift JS.Everywhere 2012
PPT
Openshift GeoSpatial Capabilities
PPTX
OpenShift with Eclipse Tooling - EclipseCon 2012
PPTX
Free Mongo on OpenShift
MongoSF - Spatial MongoDB in OpenShift - script file
Script for the geomeetup presentation
Mongo sf spatialmongo
Spatial mongo for PHP and Zend
Spatial Mongo and Node.JS on Openshift JS.Everywhere 2012
Openshift GeoSpatial Capabilities
OpenShift with Eclipse Tooling - EclipseCon 2012
Free Mongo on OpenShift

What's hot (20)

PDF
Spatial script for my JS.Everywhere 2012
PPTX
Bringing Spatial Love to Your Java Application
PPTX
Back to Basics German 3: Einführung in Replica Sets
PDF
Restinio - header-only http and websocket server
PDF
Redis clustering
PDF
Ruby on embedded devices rug::b Aug 2014
PPTX
Python Dependencies at Beeswax - BazelCon 2019 Lightning Talk - Ron Rothman
PDF
GCE NFS HA
PDF
Cloud Firestore – From JSON Deserialization to Object Document Mapping (ODM)
PDF
Build, Ship, and Run Any App, Anywhere using Docker
PDF
PDF
faastCrystal
PDF
Introduction to Hadoop - FinistJug
PDF
今日から始めるPlan 9 from Bell Labs
PPTX
Highload осень 2012 лекция 8
PPTX
nodester Architecture overview & roadmap
PPTX
Nodester Architecture overview & roadmap
PDF
Mashup your life with Yahoo Pipes
PPTX
Geek Sync | Using PowerShell with Python and SQL Server
PDF
BOSH deploys distributed systems, and Diego runs any containers
Spatial script for my JS.Everywhere 2012
Bringing Spatial Love to Your Java Application
Back to Basics German 3: Einführung in Replica Sets
Restinio - header-only http and websocket server
Redis clustering
Ruby on embedded devices rug::b Aug 2014
Python Dependencies at Beeswax - BazelCon 2019 Lightning Talk - Ron Rothman
GCE NFS HA
Cloud Firestore – From JSON Deserialization to Object Document Mapping (ODM)
Build, Ship, and Run Any App, Anywhere using Docker
faastCrystal
Introduction to Hadoop - FinistJug
今日から始めるPlan 9 from Bell Labs
Highload осень 2012 лекция 8
nodester Architecture overview & roadmap
Nodester Architecture overview & roadmap
Mashup your life with Yahoo Pipes
Geek Sync | Using PowerShell with Python and SQL Server
BOSH deploys distributed systems, and Diego runs any containers
Ad

Viewers also liked (19)

ODT
Spatial script for MongoBoulder
PDF
Introduction to PaaS for application developers
PDF
London Cloud Summit 2014 - raising the tide: getting developers in the cloud
PPTX
APPLICATIONS AND CONTAINERS AT SCALE: OpenShift + Kubernetes + Docker
PPT
Workshop For pycon13
PDF
Spatial script for CIMA
PDF
Open shift intro for Philly PUG
PPTX
Monkigras - dropping science on your developer ecosystem
ODP
Build a PaaS with OpenShift Origin
PDF
Express: the web server for node.js
PDF
Node.js and express
PPTX
Ultimate Node.js countdown: the coolest Application Express examples
PDF
Node.js with express
PDF
Node.js with Express
PDF
Introduction to Node.JS Express
PPTX
Node.js Express
PPTX
The SEAN stack - Build Web Apps With Salesforce, Express, Angular and Node.js
PDF
Create Restful Web Application With Node.js Express Framework
PPTX
Node.js and express
Spatial script for MongoBoulder
Introduction to PaaS for application developers
London Cloud Summit 2014 - raising the tide: getting developers in the cloud
APPLICATIONS AND CONTAINERS AT SCALE: OpenShift + Kubernetes + Docker
Workshop For pycon13
Spatial script for CIMA
Open shift intro for Philly PUG
Monkigras - dropping science on your developer ecosystem
Build a PaaS with OpenShift Origin
Express: the web server for node.js
Node.js and express
Ultimate Node.js countdown: the coolest Application Express examples
Node.js with express
Node.js with Express
Introduction to Node.JS Express
Node.js Express
The SEAN stack - Build Web Apps With Salesforce, Express, Angular and Node.js
Create Restful Web Application With Node.js Express Framework
Node.js and express
Ad

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

PPTX
Open Source Mapping with Python, and MongoDB
PDF
Bringing Some Spatial Love to your Application with OpenShift - Mongo Berlin ...
PPTX
Getting Started with Geospatial Data in MongoDB
PDF
Mongo db bangalore
PPT
Building web applications with mongo db presentation
PPT
MongoDB at the Silicon Valley iPhone and iPad Developers' Meetup
PDF
OSDC 2012 | Building a first application on MongoDB by Ross Lawley
PDF
Spatial script for Spatial mongo for PHP and Zend
PPTX
Conceptos básicos. Seminario web 4: Indexación avanzada, índices de texto y g...
PPTX
Geoindexing with MongoDB
PDF
Learn Learn how to build your mobile back-end with MongoDB
PDF
Geospatial and MongoDB
PPTX
Webinar: Building Your First Application with MongoDB
PPT
Nosh slides mongodb web application - mongo philly 2011
PPT
Mongo Web Apps: OSCON 2011
PPTX
Mongo db intro new
PPT
Building Your First MongoDB Application (Mongo Austin)
PDF
Real-time Location Based Social Discovery using MongoDB
PPT
Building a web application with mongo db
PDF
Building a REST API with Node.js and MongoDB
Open Source Mapping with Python, and MongoDB
Bringing Some Spatial Love to your Application with OpenShift - Mongo Berlin ...
Getting Started with Geospatial Data in MongoDB
Mongo db bangalore
Building web applications with mongo db presentation
MongoDB at the Silicon Valley iPhone and iPad Developers' Meetup
OSDC 2012 | Building a first application on MongoDB by Ross Lawley
Spatial script for Spatial mongo for PHP and Zend
Conceptos básicos. Seminario web 4: Indexación avanzada, índices de texto y g...
Geoindexing with MongoDB
Learn Learn how to build your mobile back-end with MongoDB
Geospatial and MongoDB
Webinar: Building Your First Application with MongoDB
Nosh slides mongodb web application - mongo philly 2011
Mongo Web Apps: OSCON 2011
Mongo db intro new
Building Your First MongoDB Application (Mongo Austin)
Real-time Location Based Social Discovery using MongoDB
Building a web application with mongo db
Building a REST API with Node.js and MongoDB

More from Steven Pousty (6)

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

Recently uploaded (20)

PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
Cloud computing and distributed systems.
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
KodekX | Application Modernization Development
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Electronic commerce courselecture one. Pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Empathic Computing: Creating Shared Understanding
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
cuic standard and advanced reporting.pdf
PPT
Teaching material agriculture food technology
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Unlocking AI with Model Context Protocol (MCP)
Cloud computing and distributed systems.
The AUB Centre for AI in Media Proposal.docx
KodekX | Application Modernization Development
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Reach Out and Touch Someone: Haptics and Empathic Computing
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
Electronic commerce courselecture one. Pdf
Encapsulation_ Review paper, used for researhc scholars
Network Security Unit 5.pdf for BCA BBA.
Empathic Computing: Creating Shared Understanding
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
cuic standard and advanced reporting.pdf
Teaching material agriculture food technology
Spectral efficient network and resource selection model in 5G networks
Dropbox Q2 2025 Financial Results & Investor Presentation

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