Map matching is the most basic and commonly used function in GIS software, but the traditional manual map matching is a complex and time-consuming process because there are many elements in the map, and the symbols, linetypes, colors, labels and so on need to be matched and adjusted repeatedly. AI mapping is to transfer the image Style to the vector map by learning the image, which can not only greatly improve the efficiency of mapping, but also solve the problem of map aesthetics in brainy.
SuperMap iDesktop combines the K-means clustering algorithm of Machine Learning, according to Reference map, photographic works and other pictures. Automatically transfer the picture Style to the map to quickly imitate the picture.
Functional Principle
K-means clustering algorithm
Also known as K-means, is a cluster analysis algorithm that is solved iteratively. K objects are randomly selected as the initial cluster centers, and then the distance between each object and each cluster center is calculated (the Euclidean Distance of each point of the RGB image is used in this paper), and then the similarity is classified, which can be understood as a clustering method of finding the centroid.
The basic flow of the algorithm is as follows: 1. Randomly generate K cluster centers (also can be specified by the user). 2. Calculate the distance from each sample to each cluster center. And classify that sample into the corresponding clos category. 3. Calculate the arithmetic mean of each sample, and find the point closest to the mean in each class as the new center of the class. 4. jud whether that cent point in all the categories is changed or not, if the center point is Chan, clustering the All Data by the center point again until all the center points are not changed, and ending the algorithm.
Flow chart of clustering algorithm based on K-means |
AI Mapping Principle
Based on the clustering principle of K-means algorithm, the key colors of the style image and the original map are obtained respectively. Aft that key colors are extract, the relation between the style picture and the original map is established according to an area sorting match algorithm, and the key colors of the picture are mapped to the original map, so that a map with the same color style as the picture is obtained.
AI Mapping Principle |
Step 1: Extract the key color of the style picture The main work of this
step is to input the selected custom Map Template style image, and use Machine Learning to extract the image features based on K-means clustering algorithm, so as to get the key colors in the style image. The following figure shows that the Baidu Map Template "Midnight Blue" is selected as the style image, and the key color is extracted based on the image.
Imagebased on Baidu Map Template | Picture key color |
Step 2: Extract the key color of the original map The main work of this
step is to extract the features of the original map. In order to improve the accuracy of the color feature extraction of the map, the key color of the map is extracted from the picture of the map Export as Image. The following image shows the original map in light tones and its key colors.
Original map | Original map key color |
Step 3: Area Sorting and Matching After the key color is
extracted, it is necessary to match the key color of the image with the key color of the map. According to the area matching algorithm, the color of the image is automatically matched to the original map according to the area weight. For example, the image key color (8, 48, 74) has the largest area ratio, while the original map key color (255, 255, 255) has the largest area ratio, so the original map key color (255, 255, 255) is re-rendered according to the image key color (8, 48, 74).
Schematic diagram ofarea sorting and comparison |
Based on the above process, the dark map based on Baidu Map Template style is migrated. The migration result is shown in the following figure.
Baidu MapsStyle Transfer effect |