Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Geolocalização + E-Commerce

Geolocalização + E-Commerce

Apresentação sobre geolocalização realizada no iMasters DevCommerce 2016

Alexandre Gaigalas

June 08, 2016
Tweet

More Decks by Alexandre Gaigalas

Other Decks in Technology

Transcript

  1. <?php $mongo->my_db->command([ 'geoNear' => 'my_collection', 'near' => [ -46.6579243, -23.5640367

    ], 'maxDistance' => '1' / 6378.1, 'spherical' => true, 'distanceMultiplier' => 6378.1 ]);
  2. { "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] ] ] ] }
  3. $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] ] ] ] ] ] ] ]);
  4. <?php $mongo->my_db->my_collection->find([ '$and' => [ [ 'location' => [ '$geoIntersects'

    => [ '$geometry' => $pointA ] ] ], [ 'location' => [ '$geoIntersects' => [ '$geometry' => $pointB ] ] ] ] ]);