4

It is possible to search for location with in a bounding box in fusion table as:

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

Now my question is, is it possible to search the location within a polygon of irregular shape (other than rectangle or circle) and display it on the map?

More precisely, I have fusion table with few polygons of irregular shape (using kml) in it. Another fusion table with points data in it which are lying inside the polygons of first table. Now I want to filter a polygon in first table using fusion table api so that I can only view the points inside that polygon using intersection logic.

mpsbhat
  • 2,733
  • 12
  • 49
  • 105

1 Answers1

2

Use a 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))
larsks
  • 277,717
  • 41
  • 399
  • 399
geocodezip
  • 158,664
  • 13
  • 220
  • 245
  • Is there any other keywords other than RECTANGLE & CIRCLE? I mean can I find points within an irregular polygon? – mpsbhat May 10 '13 at 04:50
  • You can find points (small circles) in a polygon defined by KML in a column with a location type. Did you look at any of my examples? – geocodezip May 10 '13 at 04:51
  • Ya... I went trough your examples. It is good. Instead of search box is it possible to use dropdown menu so that i can select a region and when selecting the map will show all the points in fusion table which lying inside that region (something like in your example 2 which shows all the points within a circular area). – mpsbhat May 10 '13 at 05:35
  • `I want to filter a polygon in first table using fusion table api so that I can only view the points inside that polygon using intersection logic` - You can do that, just not in the FusionTables query. You need to write Google Maps API v3 oode to do it. – geocodezip May 10 '13 at 13:15