Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Introduction to Geospatial Queries in MongoDB
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Hans Kristian Flaatten
December 15, 2015
Technology
0
33
Introduction to Geospatial Queries in MongoDB
Hans Kristian Flaatten
December 15, 2015
Tweet
Share
More Decks by Hans Kristian Flaatten
See All by Hans Kristian Flaatten
Continuous Deployment with Jenkins Pipelines
starefossen
0
55
Continuous Integrations with Jenkins
starefossen
0
67
Testing Node.js
starefossen
0
30
What is Node.js?
starefossen
0
41
LeftPad Not Found
starefossen
0
85
Whats New In EcmaScript 2015 / ES6
starefossen
0
70
Experience with NoSQL at the Norwegian Trekking Asocciation
starefossen
0
41
Åpen Tur- og Friluftsdata
starefossen
0
110
Reverse Engineering APIs from iOS and Android Apps
starefossen
0
64
Other Decks in Technology
See All in Technology
~Everything as Codeを諦めない~ 後からCDK
mu7889yoon
3
450
ブロックテーマ、WordPress でウェブサイトをつくるということ / 2026.02.07 Gifu WordPress Meetup
torounit
0
190
広告の効果検証を題材にした因果推論の精度検証について
zozotech
PRO
0
200
顧客との商談議事録をみんなで読んで顧客解像度を上げよう
shibayu36
0
260
OWASP Top 10:2025 リリースと 少しの日本語化にまつわる裏話
okdt
PRO
3
820
コンテナセキュリティの最新事情 ~ 2026年版 ~
kyohmizu
2
160
AIと新時代を切り拓く。これからのSREとメルカリIBISの挑戦
0gm
1
2.9k
SchooでVue.js/Nuxtを技術選定している理由
yamanoku
3
110
仕様書駆動AI開発の実践: Issue→Skill→PRテンプレで 再現性を作る
knishioka
2
680
ClickHouseはどのように大規模データを活用したAIエージェントを全社展開しているのか
mikimatsumoto
0
260
Bill One急成長の舞台裏 開発組織が直面した失敗と教訓
sansantech
PRO
2
380
SREのプラクティスを用いた3領域同時 マネジメントへの挑戦 〜SRE・情シス・セキュリティを統合した チーム運営術〜
coconala_engineer
2
670
Featured
See All Featured
Imperfection Machines: The Place of Print at Facebook
scottboms
269
14k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
9.9k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
190
From π to Pie charts
rasagy
0
120
What's in a price? How to price your products and services
michaelherold
247
13k
The SEO Collaboration Effect
kristinabergwall1
0
350
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
260
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
The Power of CSS Pseudo Elements
geoffreycrofte
80
6.2k
Ethics towards AI in product and experience design
skipperchong
2
200
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
5.8k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
140
Transcript
1 ! Geometriske Spøringer Hans Kristian Flaatten @Starefossen Bergen MongoDB
& NoSQL User Group Tirsdag 15. desember 2015 Bergen og Hordaland Turlag
Geometriske indexer • Sfærisk (Spherical) • index: 2dsphere • data:
GeoJSON • Flat (legacy) • index: 2d • data: coordinate pairs 2
2dsphere • Introdusert i MongoDB v2.4.0 • http://geojson.org/ • coordinate-axis
order: longitude, latitude • coordinate reference system: WGS84 datum 3
GeoJSON • Point (v2.4.0) • LineString (v2.4.0) • Polygon (v2.4.0)
• MultiPoint (v2.4.0) • MultiLineString (v2.6.0) • MultiPolygon (v2.6.0) • GeometryCollection (v2.6.0) 4
GeoJSON 5 { "type": "LineString", "coordinates": [ [100.0, 0.0], [101.0,
1.0], [102.0, 2.0] ], "properties": { "name": "Simple Line" } }
Coordinate Reference System (CRS) • geoid • ellipsoid (spheroid) •
Lokal: NAD1983, GDA94 • Global: WGS84, GRS80, International 1924 6
7 geoid Ellipsoide globalt best passende til geoiden Ellipsoide regionalt
tilpasset geoiden Best mulig passform
topografi geosenter b a 8 H h
Geometriske Spøringer 9 $geoWithin <Polygon> $geoIntersects <*>
$near <Point>
2dsphere index 10 db.collection.createIndex({ <location field> : "2dsphere" });
$geoWithin 11 $geoWithin: { $geometry: { type: <"Polygon" or "MultiPolygon">,
coordinates: [ <coordinates> ] } }
$geoWithin (improved) 12 $geoWithin: { $box: [ [ <bottom left
coordinates> ], [ <upper right coordinates> ] ] }
$geoIntersects 13 $geoIntersects: { $geometry: { type: <"GeoJSON object type">,
coordinates: [ <coordinates> ] } }
$near 14 $near: { $geometry: { type: "Point", coordinates: coordinates:
[<lon> , <lat>] }, $maxDistance: <distance in meters>, $minDistance: <distance in meters> }