All Projects → menduo → gobaidumap

menduo / gobaidumap

Licence: MIT license
百度地图接口调用 golang 版。支持GEO、地址双向获取,IP获取地址。Baidu Map for golang.

Programming Languages

go
31211 projects - #10 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to gobaidumap

Vue Baidu Map
Baidu Map components for Vue 2.x
Stars: ✭ 2,191 (+5665.79%)
Mutual labels:  map, baidu, baidumap
Lbsmap
利用百度地图快速实现支付宝的“到位”功能。基于LBS精确获取地理位置的周边数据,地图动态显示网络图标 支持多点聚合与分离,点击图标动态放大选中效果,移动、放大、缩小地图后重新更新数据,聚合图标点击动画展开,根据实际距离调整地图层级为屏幕大小 ,分页刷新,简书:
Stars: ✭ 313 (+723.68%)
Mutual labels:  map, baidu
Dc Sdk
DC-SDK 是基于 Cesium 进行二次开发的2、3D一体 WebGis 应用框架,该框架优化了 Cesium 的使用方式和增添了一些额外功能,旨在为开发者快速构建 WebGis 应用。🌎
Stars: ✭ 206 (+442.11%)
Mutual labels:  map, baidu
react-bmapgl
基于百度地图JavaScript GL版API封装的React组件库
Stars: ✭ 68 (+78.95%)
Mutual labels:  map, baidumap
DaoHang
一个基于百度地图api的demo,采用Material Design设计界面,有全景图、室内地图等功能。
Stars: ✭ 15 (-60.53%)
Mutual labels:  map, baidu
the-subway-of-china
中国地铁图
Stars: ✭ 104 (+173.68%)
Mutual labels:  map, baidu
react-native-s-baidumap
百度地图 React Native ,同时支持ios和android
Stars: ✭ 28 (-26.32%)
Mutual labels:  map, baidumap
xlbaidumap flutter
flutter 集成百度地图
Stars: ✭ 27 (-28.95%)
Mutual labels:  map, baidu
baidumap
Some examples of Baidu Map API
Stars: ✭ 20 (-47.37%)
Mutual labels:  baidumap
array-keyed-map
JS datastructure, like Map, but the keys are arrays
Stars: ✭ 29 (-23.68%)
Mutual labels:  map
MapCompose
A fast, memory efficient Jetpack Compose library to display tiled maps, with support for markers, paths, and rotation.
Stars: ✭ 82 (+115.79%)
Mutual labels:  map
php-collections
A collection library for php
Stars: ✭ 34 (-10.53%)
Mutual labels:  map
ets2-dashboard-skin
Packaged application in VueJs to run on a Windows computer It allows to deport some information of the video games Eurotruck simulator and Americantruck simulator on another device (via the web browser). And thus have an increased immersion in these games.
Stars: ✭ 37 (-2.63%)
Mutual labels:  map
YuanshenMap
https://gitee.com/blacklotusccw/yuanshenditu 的访问优化版(原版闭源了,本仓库停止更新)
Stars: ✭ 16 (-57.89%)
Mutual labels:  map
Low-Poly-Procedural-Generation
Low Poly Terrain generation in Unity adapted from Sebastian Langue's series
Stars: ✭ 51 (+34.21%)
Mutual labels:  map
go-go-map
百度地图瓦片下载工具 离线地图生成
Stars: ✭ 27 (-28.95%)
Mutual labels:  baidumap
leaflet-layer-tree-plugin
No description or website provided.
Stars: ✭ 31 (-18.42%)
Mutual labels:  map
cubiomes-viewer
An efficient graphical Minecraft seed finder and map viewer.
Stars: ✭ 346 (+810.53%)
Mutual labels:  map
chunks tutorial
Small demo showing how to load and manage tilemap chunks on the fly with Phaser 3
Stars: ✭ 41 (+7.89%)
Mutual labels:  map
Teyvat.moe
A flexible, community-driven interactive website for Genshin Impact.
Stars: ✭ 137 (+260.53%)
Mutual labels:  map

gobaidumap

百度地图接口调用 golang 版。支持GEO、地址双向获取,IP获取地址。

外国 IP 什么的,百度不支持。

练习 golang 时写的,见笑啦!

感谢 @zzdboy 的测试的反馈!

安装/更新

go get -u github.com/menduo/gobaidumap

注意

请到百度地图开发者中心申请自己的 App Key。代码里的常量 ak 中保证永久有效,且配额经常被大家耗光(应该是大家测试着玩呢?)。

简单说,你自己去申请一个就万事大吉啦!可以通过环境变量或者 BaiduMapClient 构造方式自定义。

使用

package main

import (
	"fmt"
	"github.com/menduo/gobaidumap"
)

func main() {

	lat := "40.069462"
	lng := "116.346364"

	bc := gobaidumap.NewBaiduMapClient(gobaidumap.GetDefaultAK())

	// 从坐标到地址
	GEOToAddress, err := bc.GetAddressViaGEO(lat, lng)

	if err != nil {
		fmt.Println(err)
	} else {
		fmt.Println("坐标到地址:", GEOToAddress)
		fmt.Println("坐标到地址 - 地址", GEOToAddress.Result.AddressComponent)
		fmt.Println("\n")
	}

	// 从地址到坐标
	address := "百度大厦"
	addressToGEO, err := gobaidumap.GetGeoViaAddress(address)
	if err != nil {
		fmt.Println(err)
	} else {

		fmt.Println("从地址到坐标 - All", addressToGEO)
		fmt.Println("从地址到坐标 - Lat", addressToGEO.Result.Location.Lat)
		fmt.Println("从地址到坐标 - Lng", addressToGEO.Result.Location.Lng)
		fmt.Println("\n")
	}

	// 从IP到地址
	ipAddress := "202.198.16.3"
	IPToAddress, err := gobaidumap.GetAddressViaIP(ipAddress)

	if err != nil {
		fmt.Println(err)
	} else {
		fmt.Println("从IP到地址:", IPToAddress)
		fmt.Println("从IP到地址 - 地址:", IPToAddress, IPToAddress.Content.Address)
		fmt.Println("\n")
	}

	// 从IP到地址
	ipAddress = "8.8.8.8"
	IPToAddress, err = gobaidumap.GetAddressViaIP(ipAddress)

	if err != nil {
		fmt.Println("从IP到地址,err !=nil:", err)
		fmt.Println("\n")
	} else {
		fmt.Println("从IP到地址:", IPToAddress)
		fmt.Println("从IP到地址 - 地址:", IPToAddress, IPToAddress.Content.Address)
		fmt.Println("\n")
	}
}

CHANGELOG

2019-01-24

  • 调整 代码结构
  • 新增 gobaidumap.NewBaiduMapClient(创建 BaiduMapClient )。
  • 新增 自定义 ak 支持(环境变量,或 client 构造传参 )
  • 调整 默认 ak 的获取方式,优先从环境变量读取,没有从取默认 ak(这个 ak 的资源配额已经被大家耗光了……)

联系 & 反馈

shimenduo at gmail dot com

https://github.com/menduo/gobaidumap/issues

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].