Git Product home page Git Product logo

latlong's Introduction

经纬度选择器

这个扩展用来帮助你在form表单中选择经纬度,用来替代Laravel-admin中内置的Form\Field\Map组件, 组件支持的地图包括Google map百度地图高德地图腾讯地图Yadex map.

Installation

composer require laravel-admin-ext/latlong -vvv

Configuration

打开config/admin.php,按照你的情况在extensions部分加上如下的配置:

    'extensions' => [

        'latlong' => [

            // 是否开始这个组件,默认true
            'enable' => true,

            // 选择下面指定的provider
            'default' => 'yandex',

            // 根据上面的选择,填写相应地图的api_key,api_key需要到相应的平台去自行申请
            'providers' => [

                'google' => [
                    'api_key' => '',
                ],

                'baidu' => [
                    'api_key' => 'xck5u2lga9n1bZkiaXIHtMufWXQnVhdx',
                ],

                'tencent' => [
                    'api_key' => 'VVYBZ-HRJCX-NOJ4Z-ZO3PU-ZZA2J-QPBBT',
                ],

                'amap' => [
                    'api_key' => '3693fe745aea0df8852739dac08a22fb',
                ],
            ]
        ]
    ]

Usage

假设你的表中有两个字段latitudelongitude分别表示纬度和经度,那么在表单中使用如下:

$form->latlong('latitude', 'longitude', '经纬度选择');

// 设置地图高度
$form->latlong('latitude', 'longitude', '经纬度')->height(500);

// 设置默认值
$form->latlong('latitude', 'longitude', '经纬度')->default(['lat' => 90, 'lng' => 90]);

License

Licensed under The MIT License (MIT).

latlong's People

Contributors

fengder avatar z-song avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.