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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Alexandre Gaigalas
June 08, 2016
Technology
170
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Geolocalização + E-Commerce
Apresentação sobre geolocalização realizada no iMasters DevCommerce 2016
Alexandre Gaigalas
June 08, 2016
More Decks by Alexandre Gaigalas
See All by Alexandre Gaigalas
Passos em Direção à Glória do REST
alganet
0
550
Porrada no Wordpress!
alganet
2
440
Microframeworks vs. Frameworks
alganet
4
370
Dados!
alganet
2
310
Domine Validação de Dados em 45min
alganet
6
490
Criação de Software para Durar
alganet
4
560
REST in PaaS
alganet
6
1.2k
Linked Data e Web Semântica
alganet
1
510
Armazenamento de Dados para Web Semântica
alganet
4
410
Other Decks in Technology
See All in Technology
新しいUbuntu/GNOMEが使いたいからXからWaylandへ移行頑張ってるの巻 2026-06-20
nobutomurata
0
160
レガシーな広告配信システムでのAI駆動開発/運用の挑戦
i16fujimoto
0
120
コミットの「なぜ」を読む
ota1022
0
120
Deep Data Security 機能解説
oracle4engineer
PRO
2
110
フィジカル版Github Onshapeの紹介
shiba_8ro
0
320
「勝手に広まる」人気 AI エージェントを爆速で作ろう!(AWS Summit Japan 2026講演資料)
minorun365
PRO
10
2.5k
【セミナー資料】Claude Code をセキュアに使うための考え方と設定の勘どころ / Claude Code Webinar 20260616
masahirokawahara
2
460
AI 不只幫你寫 Code: 當專案從 300 暴增到 1500, 我們如何撐住 DevOps
appleboy
0
220
自分が詳しくない領域でAIを使う #プロヒス2026
konifar
20
7.4k
秘密度ラベル初心者が第1歩でつまづかないための「設計・運用」ポイント
seafay
PRO
1
480
クレデンシャル流出 ― 攻撃 3 時間 vs 復旧 10 時間。この非対称性にどう備えるか
kazzpapa3
3
550
PostgreSQL 19 新機能概要 OSC Hokkaido 2026
nori_shinoda
0
240
Featured
See All Featured
Making Projects Easy
brettharned
120
6.7k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
1
2.1k
The Spectacular Lies of Maps
axbom
PRO
1
820
For a Future-Friendly Web
brad_frost
183
10k
Being A Developer After 40
akosma
91
590k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
580
We Have a Design System, Now What?
morganepeng
55
8.2k
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
370
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.9k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
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?