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
Geolocalização + E-Commerce
Search
Alexandre Gaigalas
June 08, 2016
Technology
2
140
Geolocalização + E-Commerce
Apresentação sobre geolocalização realizada no iMasters DevCommerce 2016
Alexandre Gaigalas
June 08, 2016
Tweet
Share
More Decks by Alexandre Gaigalas
See All by Alexandre Gaigalas
Passos em Direção à Glória do REST
alganet
0
500
Porrada no Wordpress!
alganet
2
420
Microframeworks vs. Frameworks
alganet
4
350
Dados!
alganet
2
280
Domine Validação de Dados em 45min
alganet
6
460
Criação de Software para Durar
alganet
4
520
REST in PaaS
alganet
6
1.1k
Linked Data e Web Semântica
alganet
1
470
Armazenamento de Dados para Web Semântica
alganet
4
390
Other Decks in Technology
See All in Technology
ピープルウエア x スタートアップ
operando
1
3.2k
datadog-incident-management-intro
tetsuya28
0
120
設計に疎いエンジニアでも始めやすいアーキテクチャドキュメント
phaya72
26
18k
日本のソブリンAIを支えるエヌビディアの生成AIエコシステム
acceleratedmu3n
0
120
Amazon Q Developer CLIをClaude Codeから使うためのベストプラクティスを考えてみた
dar_kuma_san
0
330
実践マルチモーダル検索!
shibuiwilliam
3
560
ゼロコード計装導入後のカスタム計装でさらに可観測性を高めよう
sansantech
PRO
1
690
書籍『実践 Apache Iceberg』の歩き方
ishikawa_satoru
0
460
OTEPsで知るOpenTelemetryの未来 / Observability Conference Tokyo 2025
arthur1
0
430
Snowflakeとdbtで加速する 「TVCMデータで価値を生む組織」への進化論 / Evolving TVCM Data Value in TELECY with Snowflake and dbt
carta_engineering
0
120
最近読んで良かった本 / Yokohama North Meetup #10
mktakuya
0
430
文字列操作の達人になる ~ Kotlinの文字列の便利な世界 ~ - Kotlin fest 2025
tomorrowkey
2
470
Featured
See All Featured
How GitHub (no longer) Works
holman
315
140k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
359
30k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
48
9.7k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
BBQ
matthewcrist
89
9.9k
Product Roadmaps are Hard
iamctodd
PRO
55
11k
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Side Projects
sachag
455
43k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
10
900
Principles of Awesome APIs and How to Build Them.
keavy
127
17k
Git: the NoSQL Database
bkeepers
PRO
431
66k
Transcript
Geolocalização + E-Commerce
Alexandre Gaigalas
Alexandre Gaigalas Iterador de CRUD Avançado
None
Powered by: PHP, MongoDB, MySQL, Redis, Kafka, ActiveMQ, Memcache, Amazon,
Docker, etc.
None
Encontrando Veículos
None
None
<?php $mongo->my_db->command([ 'geoNear' => 'my_collection', 'near' => [ -46.6579243, -23.5640367
], 'maxDistance' => '1' / 6378.1, 'spherical' => true, 'distanceMultiplier' => 6378.1 ]);
<?php $mongo->my_db->ensureIndex([ 'location' => '2d' ]);
None
Tem um jeito melhor?
None
None
Distâncias são relativas
None
None
Easy Share: Compartilhamento de Corridas
None
None
Lembra no colégio...
None
{ "type": "MultiPolygon", "coordinates": [ [ [ [-109.25, 36.285596], [-109.27,
40.962013], [-109.35, 36.285596] ], [ [-59.35, 36.285596], [-59.45, 40.962013], [-59.55, 36.285596] ] ] ] }
<?php $mongo->my_db->ensureIndex([ 'location' => '2dsphere' ]);
None
None
Multi-Pontos e Multi-Polígonos
{ "type": "MultiPoint", "coordinates": [ [-105.01621, 39.57422], [-80.6665134, 35.0539943] ]
}
$mongo->my_db->my_collection->find([ 'location' => [ '$geoWithin' => [ '$geometry' => [
'type' => 'MultiPolygon', 'coordinates' => [ [ [ [-109.25, 36.285596], [-109.27, 40.962013], [-109.35, 36.285596] ], [ [-59.35, 36.285596], [-59.45, 40.962013], [-59.55, 36.285596] ] ] ] ] ] ] ]);
Invertendo tudo...
<?php $mongo->my_db->my_collection->find([ '$and' => [ [ 'location' => [ '$geoIntersects'
=> [ '$geometry' => $pointA ] ] ], [ 'location' => [ '$geoIntersects' => [ '$geometry' => $pointB ] ] ] ] ]);
Obrigado!
Perguntas?