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
150
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
540
Porrada no Wordpress!
alganet
2
440
Microframeworks vs. Frameworks
alganet
4
360
Dados!
alganet
2
310
Domine Validação de Dados em 45min
alganet
6
480
Criação de Software para Durar
alganet
4
540
REST in PaaS
alganet
6
1.2k
Linked Data e Web Semântica
alganet
1
500
Armazenamento de Dados para Web Semântica
alganet
4
400
Other Decks in Technology
See All in Technology
1GB RAMのラズピッピで何ができるのか試してみよう / 20260319-rpijam-1gb-rpi-whats-possible
akkiesoft
0
700
頼れる Agentic AI を支える Datadog のオブザーバビリティ / Powering Reliable Agentic AI with Datadog Observability
aoto
PRO
0
250
AWS CDK「読めるけど書けない」を脱却するファーストステップ
smt7174
3
210
Phase06_ClaudeCode実践
overflowinc
0
750
大規模ECサイトのあるバッチのパフォーマンスを改善するために僕たちのチームがしてきたこと
panda_program
1
330
20260321_エンベディングってなに?RAGってなに?エンベディングの説明とGemini Embedding 2 の紹介
tsho
0
140
Windows ファイル共有(SMB)を再確認する
murachiakira
PRO
0
210
スピンアウト講座04_ルーティン処理
overflowinc
0
450
Tebiki Engineering Team Deck
tebiki
0
27k
OpenClaw を Amazon Lightsail で動かす理由
uechishingo
0
250
スケールアップ企業でQA組織が機能し続けるための組織設計と仕組み〜ボトムアップとトップダウンを両輪としたアプローチ〜
tarappo
3
300
20年以上続く PHP 大規模プロダクトを Kubernetes へ ── クラウド基盤刷新プロジェクトの4年間
oogfranz
PRO
0
150
Featured
See All Featured
Site-Speed That Sticks
csswizardry
13
1.1k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
2.5k
How to build a perfect <img>
jonoalderson
1
5.3k
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
280
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
310
My Coaching Mixtape
mlcsv
0
82
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
150
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.7k
Git: the NoSQL Database
bkeepers
PRO
432
66k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
68
38k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
400
The Illustrated Children's Guide to Kubernetes
chrisshort
51
52k
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?