elbgoods/nova-mapbox-shape-field
最新稳定版本:2.0
Composer 安装命令:
composer require elbgoods/nova-mapbox-shape-field
包简介
Show geo shape on a mapbox map with drawing capabilities
README 文档
README
Requirements
php: >=8.0laravel/nova: ^4.1
Features
- Shows a geo shape with drawing capabilities
Installation
Install the package in a Laravel Nova project via Composer:
composer require elbgoods/nova-mapbox-shape-field
Usage
Expects a mapbox access-token specified in config/services.php:
<?php return [ 'mapbox' => [ 'key' => env('MAPBOX_KEY', 'your-default-key'), ],
use Elbgoods\NovaMapboxShapeField\MapboxShapeField; public function fields(Request $request) { return [ MapboxShapeField::make('Geometry') // Postgres Geometry Column ->latitude($this->latitude) ->longitude($this->longitude) ->geoJson($this->getGeoJson()) ->zoom(8), ]; }
public function getGeoJson(): array { if ($this->geometry) { $geometry = $this->getGeometry(); // Brick\Geo\Geometry return [ 'type' => $geometry->geometryType(), 'coordinates' => $geometry->toArray(), ]; } return []; }
Screenshot
License
This project is open-sourced software licensed under the MIT license.
统计信息
- 总下载量: 11.48k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-08-09
