All Projects → axkuechler → laravel-geoly

axkuechler / laravel-geoly

Licence: MIT License
Perform fast and efficient radius searches on your Laravel Eloquent models.

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to laravel-geoly

geodesy-php
Geodesy PHP - Port of some known geodesic/math functions for getting distance from a known point A to a known point B given their coordinates. It also supports conversion between units of length, Polar position to Cartesian coordinates, and different Reference Datums.
Stars: ✭ 26 (+4%)
Mutual labels:  distance, latitude, longitude, distance-calculation
pikaz-location
定位插件(限中国)
Stars: ✭ 78 (+212%)
Mutual labels:  geolocation, latitude, longitude
geolocation-php-api
This Geolocation PHP class connects to Google Maps API to find latitude/longitude or the address.
Stars: ✭ 71 (+184%)
Mutual labels:  geolocation, latitude, longitude
Seeker
Accurately Locate Smartphones using Social Engineering
Stars: ✭ 2,772 (+10988%)
Mutual labels:  geolocation, latitude, longitude
haversine-js
JavaScript implementation of the Haversine formula
Stars: ✭ 12 (-52%)
Mutual labels:  radius, latitude, longitude
Vincenty-Excel
Thaddeus Vincenty's Direct and Inverse formulae for geodesic calculations in Excel (distance, azimuth, latitude, longitude).
Stars: ✭ 29 (+16%)
Mutual labels:  distance, latitude, longitude
PHPCoord
PHPCoord is a PHP library to aid in handling coordinates. It can convert coordinates for a point from one system to another and also calculate distance between points
Stars: ✭ 78 (+212%)
Mutual labels:  latitude, longitude
haversine-geolocation
Get distances between two points or get closest position to current point. Based on the Haversine Formula
Stars: ✭ 20 (-20%)
Mutual labels:  distance, geolocation
geodist
Golang package to compute the distance between two geographic latitude, longitude coordinates
Stars: ✭ 133 (+432%)
Mutual labels:  distance, geolocation
orange3-geo
🍊 🌍 Orange add-on for dealing with geography and geo-location
Stars: ✭ 22 (-12%)
Mutual labels:  geolocation, latitude
ctt
ctt postal codes into MySQL with latitude and longitude from google
Stars: ✭ 33 (+32%)
Mutual labels:  latitude, longitude
db-safedelete
Attempts to invoke force delete, if it fails - falls back to soft delete
Stars: ✭ 16 (-36%)
Mutual labels:  eloquent, model
react-cartographer
Generic component for displaying Yahoo / Google / Bing maps.
Stars: ✭ 82 (+228%)
Mutual labels:  latitude, longitude
acorn-db
Provides Acorn projects with Eloquent Models for WordPress data.
Stars: ✭ 30 (+20%)
Mutual labels:  eloquent, model
beihu-geo
地理位置解析服务,可供爬虫使用!供参考学习!
Stars: ✭ 16 (-36%)
Mutual labels:  latitude, longitude
llttz
The easy way to get java TimeZone from latitude/longitude
Stars: ✭ 27 (+8%)
Mutual labels:  latitude, longitude
erkir
Երկիր (Erkir) - a C++ library for geodesic and trigonometric calculations
Stars: ✭ 26 (+4%)
Mutual labels:  distance, distance-calculation
Positional
An elegant and colorful location information app for Android with Compass, Clock, Level, Sun, Moon, Trail Marker and many other features.
Stars: ✭ 72 (+188%)
Mutual labels:  latitude, longitude
sigsby
Sistem Informasi Geografis (SIG) / GIS Wisata Kota Surabaya Berbasis Web - www.firstplato.com
Stars: ✭ 23 (-8%)
Mutual labels:  geolocation, distance-calculation
php-haversine-formula
Calculates de distance between two geocode points 📌🗺
Stars: ✭ 44 (+76%)
Mutual labels:  latitude, longitude

Laravel Geoly

Packagist Version PHP from Packagist StyleCI GitHub

Perform fast and efficient radius searches on your Laravel Eloquent models.

Laravel Geoly provides a convenient way for your Laravel Eloquent models to query in a certain radius around a position. It is lightning fast by using a bounding box to cut down the possible results and calculating the distance only on the remaining subset. Laravel Geoly works on both MySQL and PostgreSQL.

Requirements

  • PHP 7.1+
  • Laravel 5+
  • Tested on MySQL and PostgreSQL

Installation

Simply require the project via composer:

$ composer require akuechler/laravel-geoly

How to use

Geoly assumes the two columns latitude and longitude on your eloquent model. Simply add them to your migration if not present yet.

$table->double('latitude');
$table->double('longitude');

If you prefer to use other names for your database columns, specify them in your model.

const LATITUDE  = 'lat';
const LONGITUDE = 'lng';

Use the Geoly package within your Eloquent model.

class YourModel extends Model
{
    use Geoly;
    ...
}

To search for all models within a specific radius around a position, add the radius scope to your query.

$query = YourModel::radius($latitude, $longitude, $radius);
$query->get();

Credits

This project is heavily inspired by Laravel Geographical and Movable Type Scripts article on Selecting points within a bounding circle.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].