This topic describes how to configure a map to display query results.
You can color and mark a map to display geographic data. Log Service provides three types of maps: map of China, world map, and AMap. The display modes of an AMap include the anchor point and heat map. You can include specific functions in query statements to display analysis results as maps.
- Map canvas
- Colored area
- Log on to the Log Service console.
- In the Projects section, click the name of the project that you want to manage.
- Choose , and then click the Logstore that you want to manage.
- Enter a query statement in the search box, specify a time range, and then click Search & Analyze.
- To display query results on a map of China, include the ip_to_province function in a query statement.
- To display query results on a world map, include the ip_to_country function in a query statement.
- To display query results on an AMap, include the ip_to_geo function in a query statement.
- On the Graph tab, click the icon.In this example, the map of China is selected.
- On the Properties tab, configure the properties of the map of China.
Parameter Description Location information The location information that is recorded in logs. The information is displayed in one of the following dimensions based on the map type:
- Provinces (Map of China)
- Country (World Map)
- Longitude/Latitude (AMap)
Value Column The data volume of the location information. Show Legend If you turn on the Show Legend switch, the legend information is displayed.
Example of a map of China
* | select ip_to_province(remote_addr) as address, count(1) as count group by address order by count desc limit 10
Example of a world map
* | select ip_to_country(remote_addr) as address, count(1) as count group by address order by count desc limit 10
Example of an AMap
concat('lat', ',', lng')function to combine the two columns into one column.
* | select ip_to_geo(remote_addr) as address, count(1) as count group by address order by count desc limit 10
By default, the display mode of the anchor points is returned. If the anchor points are densely distributed on the map, you can select the display mode of heat map.