定制 imumz/leaflet-map 二次开发

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

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

imumz/leaflet-map

最新稳定版本:1.1

Composer 安装命令:

composer require imumz/leaflet-map

包简介

A Laravel Nova field.

README 文档

README

GitHub release (latest by date) Packagist

NovaLeafletMap

Custom Laravel Nova map field using Vue2Leaflet. Supports Google Maps, marker clustering, height, zoom, latitude and longitude coordinates, GeoJSON, marker popup and custom marker icon.

Looking for a Laravel Nova map card? (https://github.com/iMuMz/NovaMapCard)

image

Installation

composer require imumz/leaflet-map

Usage

use Imumz\LeafletMap\LeafletMap
...
LeafletMap::make('Map View')

Available Methods

Zoom

LeafletMap::make('Map View')
->zoom(8)

Height

LeafletMap::make('Map View')
->height('400px') // default is 300px

Google Maps

By default the provider is OpenStreetMaps.
You must set your Google Maps API key (https://developers.google.com/maps/documentation/javascript/get-api-key).

LeafletMap::make('Map View')
->googleApiKey('')
->googleMapType('roadmap'), // roadmap, satellite or hybrid

Latitude / Longitude (Point)

The map will automatically center to the coordinates provided.

LeafletMap::make('Map View')
->type('LatLon')
->point($this->my_latitude,$this->my_longitude)

GeoJSON

You have to manually set the GeoJson center.

LeafletMap::make('Map View')
->type('GeoJson')
->geoJson('')
->center('-6.081689','145.391881')

GeoJson Example

{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": {
        "popup": "I am a Popup"
      },
      "geometry": {
        "type": "Point",
        "coordinates": [
          23.8623046875,
          -30.221101852485987
        ]
      }
    }
  ]
}

Popup

LeafletMap::make('Map View')
->popupName('popup')

Custom Marker Icon

LeafletMap::make('Map View')
->mapIconUrl('/images/marker-icon.png')

You can now pass additional parameters to set the icon size and anchor

->mapIconUrl('/images/marker-icon.png',[100,100],[50,50])

Screenshot 2020-10-06 at 10 09 14

统计信息

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

GitHub 信息

  • Stars: 8
  • Watchers: 2
  • Forks: 2
  • 开发语言: Vue

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-01-20