uniapp get map data (Gaode, geocoding, anti-geocoding) plug-in Ba-AMapData

Introduction ( download address )

Ba-AMapData is a plug-in for obtaining Gaode map data, and now it has geocoding and anti-geocoding.

Instructions

Apply for and configure Gaode appkey

On the Gaode open platform , apply for the Gaode appkey.

In manifest.json, configure the applied appkey, as shown below:

insert image description here

Import components

scriptIntroduce components in

	const amapData = uni.requireNativePlugin('Ba-AMapData')

transfer

scriptcalled in

    const amapData = uni.requireNativePlugin('Ba-AMapData')
	export default {
    
    
		data() {
    
    
			return {
    
    
				dateUtil: dateUtil,
				msgList: [],
				address: '北国商城',
				city: '',
				longitude: 116.39751,
				latitude: 39.90865,
				range: 200
			}
		},
		methods: {
    
    
			getGeocode() {
    
     //获取地理编码
				amapData.getGeocode({
    
    
						name: this.address,//位置信息
						city: this.city,//查询城市
					},
					res => {
    
    
						console.log(res);
						if (res.data) {
    
    
							this.msgList.unshift(JSON.stringify(res.data))
							this.msgList.unshift(dateUtil.now())
						}
						uni.showToast({
    
    
							title: res.msg,
							icon: "none",
							duration: 3000
						})
					});
			},
			getRegeocode() {
    
     //获取逆地理编码
				amapData.getRegeocode({
    
    
						longitude: this.longitude,//经度
						latitude: this.latitude,//纬度
						range: this.range,//范围(米)
					},
					res => {
    
    
						console.log(res);
						if (res.data) {
    
    
							this.msgList.unshift(JSON.stringify(res.data))
							this.msgList.unshift(dateUtil.now())
						}
						uni.showToast({
    
    
							title: res.msg,
							icon: "none",
							duration: 3000
						})
					});
			},
		}
	}

api list

method name illustrate
getGeocode get geocode
getRegeocode Get reverse geocode

Series plug-in

Image selection plugin Ba-MediaPicker ( documentation )

Image editing plugin Ba-ImageEditor ( documentation )

File picker plugin Ba-FilePicker ( documentation )

Application message notification plug-in (multiple styles, new support for resident notification mode) Ba-Notify ( documentation )

Apply the unread badge plugin Ba-Shortcut-Badge ( documentation )

Applying the Ba-Autoboot plugin ( documentation )

Scan code native plug-in (millisecond level, support multi-code) Ba-Scanner-G ( documentation )

Native plug-in for scanning code - new (can customize the interface version arbitrarily; support continuous scanning code; support setting scanning code format) Ba-Scanner ( documentation )

Dynamically modify the status bar, navigation bar background color, font color plug-in Ba-AppBar ( documentation )

Native sqlite local database management Ba-Sqlite ( documentation )

Android keep-alive plug-in (using a variety of mainstream technologies) Ba-KeepAlive ( documentation )

Android shortcut (desktop long press app icon) Ba-Shortcut ( documentation )

Custom image watermark (anywhere) Ba-Watermark ( documentation )

The closest image compression plug-in to WeChat is Ba-ImageCompressor ( documentation )

Video compression, video editing plug-in Ba-VideoCompressor ( documentation )

Dynamically switch application icons and names (such as New Year, National Day, etc.) Ba-ChangeIcon ( documentation )

Native Toast pop-up prompt (through all interfaces, through native; custom colors, icons) Ba-Toast ( documentation )

Image graffiti, brush Ba-ImagePaint ( documentation )

pdf reading (gesture zoom, display page number) Ba-Pdf ( documentation )

Sound reminder, vibration reminder, voice broadcast Ba-Beep ( documentation )

Websocket native service (automatic reconnection, heartbeat detection) Ba-Websocket ( documentation )

SMS monitoring (verification code) Ba-Sms ( documentation )

Smart Install (Automatic Upgrade) Ba-SmartUpgrade ( documentation )

Monitor system broadcast, custom broadcast Ba-Broadcast ( documentation )

Listen to notification bar messages (support whitelist, blacklist, filter) Ba-NotifyListener ( documentation )

Global graying, mourning graying (dynamic, support nvue, vue at the same time) Ba-Gray ( documentation )

Get Device Unique Identifier (OAID, AAID, IMEI, etc.) Ba-IdCode ( documentation )

Real-time positioning (system, background operation, support screen) plug-in Ba-Location ( documentation )

Real-time positioning (AutoNavi, running in the background, supporting screen information, coordinate conversion, distance calculation) Ba-LocationAMap ( documentation )

Widgets, Desktop Widgets, Widgets Ba-AppWidget ( documentation )

Widgets, widgets, widgets (calendar, time) Ba-AwCalendarS ( documentation )

Picture-in-picture floating window (video) Ba-VideoPip ( documentation )

Floating window (displayed on top of other applications) Ba-FloatWindow ( documentation )

Floating window (in-app, no authorization required) Ba-FloatWindow2 ( documentation )

Floating window (floating ball, dynamic menu, display on top of other applications) Ba-FloatBall ( documentation )

Added to "Open with other apps" for file delivery, sharing, etc. Ba-ShareReceive ( documentation )

Get Map Data (Geocode, Geocoding, Anti-Geocoding) Ba-AMapData ( documentation )

Guess you like

Origin blog.csdn.net/u013164293/article/details/129388362