承接 digitalcloud/laravel-postgis 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

digitalcloud/laravel-postgis

Composer 安装命令:

composer require digitalcloud/laravel-postgis

包简介

README 文档

README

This package implemented for calculate or check the distance between point and other database points.

Installation

PHP >=7.1.3 and Laravel ^5.6 are required.

the package used Laravel postgis extension to deal with postgres database points in laravel, so if need more details or how to enable postgis extension in php see previous link.

To get the latest version of Laravel PostGIS, simply require the project using Composer:

composer require digitalcloud/laravel-postgis

Usage

1 . First of all use Postgis trait in your model

<?php

namespace App;

use Digitalcloud\Postgis\Postgis;
use Illuminate\Database\Eloquent\Model;

class UserLocation extends Model
{
    use Postgis;
}

2 . By default package assume that the name of the point column is location if you want to change it override location variable on your model

protected $location = "my_column";

3 . Also By default package assume that the unit of distance is meter if you want to change it override unit variable on your model

 protected $unit = "km"; //units avialble [mile, km, meter]

Functions

1. withDistance

get the distance between point and other points

UserLocation::withDistance(new Point($atitude,$longitude))
            ->with("user")
            ->whereIn("user_id", $users)
            ->get();

2. whereDistance

check the distance between a point and other points in database

       UserLocation::whereDistance(new Point($atitude,$longitude), ">", 50)
            ->with("user")
            ->whereIn("user_id", $users)
            ->get();

统计信息

  • 总下载量: 1.94k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 12
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 12
  • Watchers: 2
  • Forks: 8
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-10-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固