Maplatform 2.1.0

dotnet add package Maplatform --version 2.1.0                
NuGet\Install-Package Maplatform -Version 2.1.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Maplatform" Version="2.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Maplatform --version 2.1.0                
#r "nuget: Maplatform, 2.1.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Maplatform as a Cake Addin
#addin nuget:?package=Maplatform&version=2.1.0

// Install Maplatform as a Cake Tool
#tool nuget:?package=Maplatform&version=2.1.0                

地图平台工具包

介绍

包含简单的百度云地图、QQ地图、高德地图解析对象。

封装方法

  1. 地址解析
  2. 批量距离计算
  3. IP定位

安装教程

在VS中,使用NuGet给对应项目安装组件[NuGet组件]

使用说明

  1. 地址解析

使用SafelyMapManager类提供的GetPlatform方法, 再通过IMaplatform接口调用Geocoder方法实现地址解析

IMaplatform baidu = SafelyMapManager.GetPlatform(Model.Platform.BAIDU, "获取相应平台秘钥KEY");
var result = baidu.Geocoder("详细地址", "城市名称");

参数说明

GetPlatform方法

参数 是否必传 说明
参数一 根据提供的Model.Platform枚举类,调用BAIDU、QQ、GAODE
参数二 地图平台秘钥KEY

Geocoder方法

参数 是否必传 说明
参数一 详细地址
参数二 城市名称 (传空字符串)
其它参数 根据地图平台地址解析查看

正确时返回的JSON数据包如下

{
    "Status": 0,
    "AddressComponents": {
	    "Province": "上海市",
	    "City": "上海市",
	    "District": "黄浦区"
    },
    "Location": {
	    "Lat": 31.2272940412404,
	    "Lng": 121.484735788434
    }
}
  1. 批量距离计算

使用SafelyMapManager类提供的GetPlatform方法, 再通过IMaplatform接口调用BatchCalculation方法实现地址解析

IMaplatform baidu = SafelyMapManager.GetPlatform(Model.Platform.BAIDU, "获取相应平台秘钥KEY");
var result = baidu.BatchCalculation(Model.Calculation.DRIVING, "起点坐标", "终点坐标");

参数说明

GetPlatform方法的使用(同上地址解析)

BatchCalculation方法

参数 是否必传 说明
参数一 根据提供的Model.Calculation枚举类,调用DRIVING (驾车)、WALKING (步行)
参数二 起点坐标:包装经纬度属性类传参 (只支持一个坐标点)
参数三 终点坐标:包装经纬度属性列表类传参 (支持多个坐标点)
其它参数 根据地图平台距离测量查看

正确时返回的JSON数据包如下

{
    "Status": 0,
    "Result": [{
	    "Distance": {
	        "Text": "52.6公里",
	        "Value": 52647
	    },
	    "Duration": {
	        "Text": "33分钟",
	        "Value": 1974
	    }
    }, {
	    "Distance": {
	        "Text": "54.4公里",
	        "Value": 54435
	    },
	    "Duration": {
	        "Text": "34分钟",
	        "Value": 2041
	    }
    }]
}
  1. IP定位

使用SafelyMapManager类提供的GetPlatform方法, 再通过IMaplatform接口调用IP方法实现IP定位

IMaplatform baidu = SafelyMapManager.GetPlatform(Model.Platform.BAIDU, "获取相应平台秘钥KEY");
var result = baidu.IP("114.247.50.2");

参数说明

GetPlatform方法的使用(同上地址解析)

IP方法

参数 是否必传 说明
参数一 IP地址
其它参数 根据地图平台IP定位查看

正确时返回的JSON数据包如下

{
    "Status": 0,
    "Province": "北京市",
    "City": "北京市",
    "Location": {
        "Lat": 39.91488908,
        "Lng": 116.40387397
    }
}
Product Compatible and additional computed target framework versions.
.NET Framework net452 is compatible.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Maplatform:

Package Downloads
UmbracoExtending.Dealer

Umbraco extending lib, dealer management in Umbraco Backoffice. 1.Install this component via VS NuGet. 2.Publish and Install Umbraco Site. 3.Import data in ueDealer.sql file in /App_Data. 4.Add Assign access for user group. 5.You can use it!!!

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.1.0 698 4/16/2019
1.1.0 604 4/10/2019
1.0.0 614 4/10/2019

Add Calculation and IP method support.