Fusion Spatial Query

In the merge table, you can find the location in the bounding box:

SELECT * FROM <tableid> WHERE ST_INTERSECTS(<location_column>, RECTANGLE(LATLNG(B, Y), LATLNG(A, X)) 

Now my question is: is it possible to search for a location in an irregularly shaped polygon (except for a rectangle or circle) and display it on the map?

More precisely, I have a merge table with several irregularly shaped polygons (using kml). Another merge table with data points in it that lie inside the polygons of the first table. Now I want to filter the polygon in the first table using the api fusion table so that I can only see the points inside this polygon using the intersection logic.

+4
source share
1 answer

Use the small CIRCLE around the point. If your <location_column> contains polygons, <latitude> / <longitude> are the coordinates of the point you are looking for:

 SELECT * FROM <tableid> WHERE ST_INTERSECTS(`<location_column>`, CIRCLE(LATLNG(`<latitude>`, `<longitude>`), 0.5)) 
+2
source

Source: https://habr.com/ru/post/1479700/


All Articles