This topic describes how to configure a map to display query results.

Background information

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 obtain analysis results as maps.

Each map consists of the following elements:
  • Map canvas
  • Colored area

Procedure

  1. Log on to the Log Service console.
  2. In the Projects section, click the name of the project that you want to view.
  3. Choose Log Storage > Logstores. On the Logstores tab, click the Logstore that you want to view.
  4. 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.
  5. On the Graph tab, perform one of the following operations:
    • Click the Map - 001 icon.
    • Click the World map icon.
    • Click the AMap icon.
    • Click the Heat map icon.
  6. On the Properties tab, configure the properties of the timeline chart.
    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

To display query results on a map of China, you can execute the following query statement that includes the ip_to_province function:
* | select  ip_to_province(remote_addr) as address, count(1) as count group by address order by count desc limit 10
Set Provinces to address and set Value Column to count. 1

Example of a world map

To display query results in a world map, you can execute the following query statement that includes the ip_to_country function:
* | select  ip_to_country(remote_addr) as address, count(1) as count group by address order by count desc limit 10
Set the Country to address and set Value Column to count. 2

Example of an AMap

To display query results on an AMap, you can execute the following query statement that includes the ip_to_geo function. The dataset contains the latitude and longitude values, which are separated by a comma (,).
* | select  ip_to_geo(remote_addr) as address, count(1) as count group by address order by count desc limit 10
Note If the longitude and latitude values are contained in two separate columns named lng and lat, you can use the concat('lat', ',', lng') function to combine the two columns into one column.

Set Longitude/Latitude to address and Value Column to count.

AMap

If the anchor points are densely distributed on the map, you can select the display mode of heat map.