承接 salvaworld/laravel-spatial 相关项目开发

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

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

salvaworld/laravel-spatial

最新稳定版本:v1.0.4

Composer 安装命令:

composer require salvaworld/laravel-spatial

包简介

Spatial data types extension for Laravel.

README 文档

README

This package is fully undocumented and unstable, and is a combination of the two great packages:

Installation

Installation made super-easy with composer:

composer require salvaworld/laravel-spatial

Requirements

Works with PostgreSQL installed PostGIS extension and MySQL at least version 5.6.

If you try using it on a shared host which is not fulfilling those requirements, change your provider.

Usage

Migrations

Add spatial fields to your migrations the same way you would any others:

    $table->point('point_column');
    $table->linestring('line_string_column');
    $table->polygon('polygon_column');
    $table->geometry('geometry_column');

    $table->multipoint('multi_point_column');
    $table->multilinestring('multi_line_string_column');
    $table->multipolygon('multi_polygon_column');
    $table->geometrycollection('geometry_collection_column');

Models

Any models that use spatial fields need to use the LaravelSpatial\Eloquent\SpatialTrait, and list the spatial fields themselves in the $spatialFields property:

use LaravelSpatial\Eloquent\SpatialTrait;

// ...

class MyModel extends Model
{
    use SpatialTrait;

    // ...

    protected $spatialFields = ['location'];

    // ...
}

Values

We use the GeoJson PHP Library for describing spatial fields as GeoJSON object, e.g.:

use GeoJSON\Geometry\Point;

// ...

$eloquent = new MyModel();
$eloquent->location = new Point([49.7, 6.9]);

// ...

$eloquent->save();

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-06-20