This article mainly introduces the basic knowledge of map in wxapp, and provides simple examples to help you learn and understand the map. For more information, see
Map of wxapp:
Map
| Attribute name |
Type |
Default value |
Description |
| Longpolling |
Number |
|
Central longitude |
| Latitude |
Number |
|
Central Latitude |
| Scale |
Number |
1 |
Zoom level |
| Markers |
Array |
|
Mark Point |
| Covers |
Array |
|
Covering |
Mark Point
A markup point is used to display the marked position on a map. you cannot customize icons and styles.
| Attribute |
Description |
Type |
Required |
Remarks |
| Latitude |
Latitude |
Number |
Yes |
Floating point number in the range of-90 ~ 90 |
| Longpolling |
Longitude |
Number |
Yes |
Floating point number, range:-180 ~ 180 |
| Name |
Name Tagging |
String |
Yes |
|
| Desc |
Detailed description |
String |
No |
|
Covering
A cover is used to display custom icons and styles on a map.
| Attribute |
Description |
Type |
Required |
Remarks |
| Latitude |
Latitude |
Number |
Yes |
Floating point number in the range of-90 ~ 90 |
| Longpolling |
Longitude |
Number |
Yes |
Floating point number, range:-180 ~ 180 |
| IconPath |
Displayed icon |
String |
Yes |
Path of the image under the Project Directory, supporting relative path writing |
| Rotate |
Rotation angle |
Number |
No |
Clockwise rotation angle, ranging from 0 ~ 360. the default value is 0. |
The longitude and latitude of the map component are required. if the longitude and latitude are not specified, the default value is the longitude and latitude of Beijing.
Markers can only be set during initialization. dynamic updates are not supported.
Example:
// Map. jsPage ({data: {markers: [{latitude: 23.099994, longpolling: 113.324520, name: 'T. I .T creative park ', desc: 'My current location'}], covers: [{latitude: 23.099794, longpolling: 113.324520, icaonPath :'.. /images/car.png ', rotate: 10}, {latitude: 23.099298, longpolling: 113.324129, iconPath :'.. /images/car.png ', rotate: 90}]})
Thank you for reading this article. I hope it will help you. thank you for your support for this site!
For more details about wxapp map, please pay attention to PHP!