Giter Site home page Giter Site logo

yz-gpshelp's Introduction

yz-gpshelp

ps: 工具依赖 axios 异步访问服务

使用步骤

  1. 项目中安装该工具
    yarn add yz-gpshelp
  1. 项目中安装gpshelp(同 vue-router)
    import gpshelp from 'yz-gpshelp'
    
    Vue.use(gpshelp)
  1. 使用
    Vue.$gps.getLocation()
    this.$gps.getLocation()
    Vue.$gps.getAddressByLocation()
    this.$gps.getAddressByLocation()
    Vue.$gps.getLocationByAddress()
    this.$gps.getLocationByAddress()
    Vue.$gps.createGoogleMapUrl()
    this.$gps.createGoogleMapUrl()

getLocation()

H5 定位

    return (Promise)

    {
       ....
       coords: {
           latitude: 纬度,
           longitude: 经度,
           .....
       } 
       .....
    }

getAddressByLocation(params)

根据坐标获取地址信息

    params (Object)

    {
        lat: 纬度,
        lon: 经度
    }

    returen (Promise)

    {
        getTime: 地理信息获取时间,
        Address: {
            display_name: d地址显示名称,
            country: 国家,
            ....
        },
        Location: {
            lat: 纬度,
            lon: 经度
        }
    }

getLocationByAddress(params)

地址查询根据地址信息获取位置坐标(坐标偏差较大)

    params (String)

    详细地址信息

    returen (Promise)

    {
        lat: 纬度,
        lon: 经度
    }

createGoogleMapUrl(params)

生成google地图URL

    parmas (String or Object)

        String: 地址信息

        Object: {
            lat: 纬度,
            lon: 经度
        }

    return (String)

    GoogleMap URL

yz-gpshelp's People

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.