定制 davidpiesse/nova-map 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

davidpiesse/nova-map

最新稳定版本:0.0.9

Composer 安装命令:

composer require davidpiesse/nova-map

包简介

Map field for Laravel Nova

README 文档

README

Total Downloads Latest Stable Version

Map Field

This map field currently ONLY shows in details view

Gif!

You can use this Map Field with three different sort of spatial data:

  • GeoJSON String property

  • Latitude and Longitude properties

  • Latitude and Longitude both in a single text field

  • Core Laravel Spatial Types

    • Point
    • LineString
    • Polygon
    • Geometry
    • GeometryCollection
    • MultiPoint
    • MultiLineString
    • MultiPolygon To use these core types you need to install grimzy/laravel-mysql-spatial See the section below on setting this up. This can work with other databases, but YMMV.
  • You can set the height of the map in px

  • The field is disabled in Index and Form views by default

  • This is very much a WIP - please submit issues to GitHub

Spatial Types

To specify what sort of spatial data you are passing to this field you MUST set the spatialType() for example

    ->spatialType('Point')

These are the valid Spatial Types

  • LatLon
  • LatLonField (single field)
  • GeoJSON
  • Point
  • LineString
  • Polygon
  • Geometry
  • GeometryCollection
  • MultiPoint
  • MultiLineString
  • MultiPolygon

Examples

Point

Map::make('Some Point Field', 'point_field_name')
    ->spatialType('Point'),

Polygon

Map::make('Some Polygon Field', 'polygon_field_name')
    ->spatialType('Polygon'),

GeoJSON

Map::make('Some GeoJSON Field')
    ->spatialType('GeoJSON')
    ->geojson('geojson_field_name'),

Latitude & Longitude (in seperate fields)

Map::make('Some Point Location')
    ->spatialType('LatLon')
    ->latitude('latitude_field_name')
    ->longitude('longitude_field_name'),

Latitude & Longitude (in single fields)

Map::make('Some Point Location', 'coordinate_field_name')
    ->spatialType('LatLonField'),

Set the Height

Map::make('Some Point Field', 'point_field_name')
    ->spatialType('Point')
    ->height('300px'),

Setting up the Laravel Spatial Types

You need to install grimzy/laravel-mysql-spatial into your main application

composer require grimzy/laravel-mysql-spatial

Add the SpatialTrait to your Model

use SpatialTrait;

You then also need to set any spatial fields you have set in the Model

protected $spatialFields = [
    'geo_point',
    'geo_linestring',
    ...
];

Your Model is now ready to process spatial data to Nova

Future Development

  • Editing capabilities for all Spatial Types
  • View Place Field address on a Map
  • Remove reliance on grimzy package from accessing core Spatial Types
  • Allow all DB spatial fields to be used
  • Customize the map futher
    • Tailwind Height classes
    • Customise Geometry Styling
      • Marker Icon
      • Colors, Thicknesses, Opacity
    • Basemap
      • Streets
      • Topo
      • Satellite
    • Navigation Tools (Compass, Zoom In/Out)
  • Alternative Map Providers
    • Google Maps
    • Mapbox
    • OpenLayers

统计信息

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

GitHub 信息

  • Stars: 115
  • Watchers: 8
  • Forks: 27
  • 开发语言: Vue

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-08-27