Map matching serves as the most fundamental and widely used function in GIS software. However, traditional manual map matching proves to be a complex and time-consuming process due to numerous map elements requiring repeated adjustments of symbols, line types, colors, labels, etc. AI Mapping transfers image styles to vector maps through machine learning, significantly enhancing mapping efficiency while resolving cartographic aesthetic challenges.
SuperMap iDesktop integrates the K-means clustering algorithm from machine learning. By referencing maps, photographic works, and other images, it automatically transfers image styles to maps for rapid style emulation.
Functional Principle
K-Means Clustering Algorithm
Also known as K-means, this iterative cluster analysis algorithm randomly selects K objects as initial cluster centers. It calculates distances between each object and cluster centers (using RGB image Euclidean distances in this context) for similarity-based classification, essentially a centroid-seeking clustering method.
The algorithm workflow comprises: 1. Randomly generate K cluster centers (user-specifiable). 2. Calculate distances from samples to centers, classifying samples accordingly. 3. Compute arithmetic means for each cluster, identifying nearest points to means as new centers. 4. Repeat clustering until center points stabilize, then terminate.
![]() |
K-Means Clustering Algorithm Flowchart |
AI Mapping Principle
Leveraging K-means clustering, the solution extracts key colors from both style images and original maps. Through area-based sorting and matching algorithms, it establishes color correspondence between source images and maps, enabling style transfer to produce maps with matching color schemes.
![]() |
AI Mapping Principle |
Step 1: Extract Key Colors From Style Image
This phase involves processing selected map template images (e.g., Baidu Map's "Midnight Blue" template) using K-means clustering to identify dominant colors. The illustration shows a style image and its extracted key colors.
![]() |
![]() |
Baidu Map Template Image | Extracted Key Colors |
Step 2: Extract Key Colors From Original Map
This stage extracts color features from map export images to ensure accuracy. The example demonstrates a light-toned original map and its key colors.
![]() |
![]() |
Original Map | Map Key Colors |
Step 3: Area Sorting and Matching
The system matches image and map key colors through area-weighted algorithms. For instance, the largest-area image color (8,48,74) replaces the predominant map color (255,255,255). This proportional matching ensures style consistency.
![]() |
Area Sorting Comparison Diagram |
The final result demonstrates successful style transfer from Baidu Map template, as shown below.
![]() |
Baidu Map Style Transfer Result |