How to use uniapp to develop a simple map navigation? This article will provide you with an idea for making a simple map. I hope it will be helpful to you!
Let’s take a look at the renderings first
##Simple map
In the map in Figure 1, you can see that point a is connected to point b, basic information and basic controls (zoom in, zoom out, return to a specified point). Next, we will proceed step by step explain.
Required configuration
needs to be in
app module in manifest.json Configure the map and add the key of the relevant map. If not, you can apply on the relevant developer platform
After configuring this part, you can start using the map Component
Map marker points
To create marker points in uniapp map, you need to use an attribute
markers .
Let’s first take a look at the common attributes of
markers
Name
Description
Type
Required
##id
Mark point id
number
true
latitude
latitude
number
true
longitude
Longitude
number
true
##iconPath
Displayed icon
string
false
callout
Customize the bubble box above the mark point
Object
false
label
Add a label to the marked point
Object
false
For more information, please check:
https://uniapp.dcloud.io/component/map.html
After understanding these, we can use
markers
The attribute creates marker points.
markersThe attribute is of array type, so marker points should be created like this
let appUrl = `qqmap://map/geocoder?coord=${latitude},${longitude}&referer=${腾讯地图key}`
Copy after login
web url
let webUrl = `https://apis.map.qq.com/uri/v1/marker?marker=coord:经度,纬度;title:名称;addr:地址&referer=myapp`
Copy after login
百度
app url
let appUrl = `baidumap://map/marker?location=${latitude},${longitude}&title=${name}&coord_type=gcj02&src=andr.baidu.openAPIdemo`
Copy after login
web url
let webUrl = `http://api.map.baidu.com/marker?location=${latitude},${longitude}&title=${name}&content=${content}&output=html&src=webapp.baidu.openAPIdemo`
The above is the detailed content of Use uniapp to develop a simple map navigation. For more information, please follow other related articles on the PHP Chinese website!
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn