SELECT ST_GeomFromText (' GEOMETRYCOLLECTION (POINT (10, 10), POINT (10, 10), POINT (10, 11), POINT (10) 10.5, polygon ((9, 9, 11 9, 11, 11, 9, 11, 9, 9))) ");
The distance is just a simple case, when I deal with three million data, the map of tiles segmentation, then put these tiles regional visualization, my three million points are the POLYGON (tile area) to cover,
The following is my function creates, connect the polygon and point using GEOMETRYCOLLECTION function
CREATE DEFINER=` root ` @ ` localhost ` FUNCTION ` f_2 ` (xtile int, ytile int, lon float, lat float) RETURNS a varchar (200) CHARSET utf8mb4
The BEGIN
Declare s varchar (200);
Declare s1 varchar (200);
Declare a1 varchar (50);
Declare a2 varchar (50);
Declare a3 varchar (50);
Declare a4 varchar (50);
Declare lon_deg float;
Declare lat_deg float;
Declare lon_deg1 float;
Declare lat_deg1 float;
Declare lon_deg2 float;
Declare lat_deg2 float;
Declare lon_deg3 float;
Declare lat_deg3 float;
Declare lon_deg4 float;
Declare lat_deg4 float;
Set lon_deg xtile/16384 * 360.0=180.0;
The set lat_deg=ATAN ((EXP ((PI () * (1-2 * ytile/16384))) - EXP (- (PI () * (1-2 * ytile/16384))))/2) * (180.0/PI ());
The set lon_deg1=lon_deg - 180/(2 ^ 15);
The set lat_deg1=lat_deg + 180/(2 ^ 15);
The set lon_deg2=lon_deg + 180/(2 ^ 15);
The set lat_deg2=lat_deg + 180/(2 ^ 15);
The set lon_deg3=lon_deg - 180/(2 ^ 15);
The set lat_deg3=lat_deg - 180/(2 ^ 15);
The set lon_deg4=lon_deg + 180/(2 ^ 15);
The set lat_deg4=lat_deg - 180/(2 ^ 15);
Set a1=concat (cast (lon_deg1 as char), ' ', cast lat_deg1 as char ());
Set a2=concat (cast (lon_deg2 as char), ' ', cast lat_deg2 as char ());
Set a3=concat (cast (lon_deg3 as char), ' ', cast lat_deg3 as char ());
Set a4=concat (cast (lon_deg4 as char), ' ', cast lat_deg4 as char ());
Set s=concat (' POLYGON ((', and a3, ', ', a4, ', ', a2, ', ', a1, ' ', and a3, ')) ");
Set s1=concat (' GEOMETRYCOLLECTION (POINT (', cast (lon as char), ' ', cast (lat as char), '), ', s, and ') ');
RETURN s1.
END
When I perform directly
SELECT ST_GeomFromText (f_2 (bgn_xtile bgn_ytile, bgn_lon, bgn_lat)) from the map;, can only get the graphics shown in the figure below