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
130
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
490
Porrada no Wordpress!
alganet
2
420
Microframeworks vs. Frameworks
alganet
4
340
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
なぜスクラムはこうなったのか?歴史が教えてくれたこと/Shall we explore the roots of Scrum
sanogemaru
5
1.5k
DDD集約とサービスコンテキスト境界との関係性
pandayumi
2
270
シークレット管理だけじゃない!HashiCorp Vault でデータ暗号化をしよう / Beyond Secret Management! Let's Encrypt Data with HashiCorp Vault
nnstt1
3
230
[RSJ25] Feasible RAG: Hierarchical Multimodal Retrieval with Feasibility-Aware Embodied Memory for Mobile Manipulation
keio_smilab
PRO
0
120
生成AI時代のデータ基盤設計〜ペースレイヤリングで実現する高速開発と持続性〜 / Levtech Meetup_Session_2
sansan_randd
1
140
これでもう迷わない!Jetpack Composeの書き方実践ガイド
zozotech
PRO
0
150
2025年にHCP Vaultを学び直して見えた景色 / Lessons and New Perspectives from Relearning HCP Vault in 2025
aeonpeople
0
220
AI駆動開発に向けた新しいエンジニアマインドセット
kazue
0
300
AIのグローバルトレンド2025 #scrummikawa / global ai trend
kyonmm
PRO
1
250
20250910_障害注入から効率的復旧へ_カオスエンジニアリング_生成AIで考えるAWS障害対応.pdf
sh_fk2
3
170
研究開発と製品開発、両利きのロボティクス
youtalk
1
500
dbt開発 with Claude Codeのためのガードレール設計
10xinc
1
830
Featured
See All Featured
A better future with KSS
kneath
239
17k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
61k
KATA
mclloyd
32
14k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
139
34k
Facilitating Awesome Meetings
lara
55
6.5k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
What's in a price? How to price your products and services
michaelherold
246
12k
The Pragmatic Product Professional
lauravandoore
36
6.9k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
1.5k
Faster Mobile Websites
deanohume
309
31k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
23
1.4k
Why Our Code Smells
bkeepers
PRO
339
57k
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?