Search code examples
google-maps-api-3google-fusion-tables

Using ST_INTERSECT in a google maps Fusion Table results in Bad Request


I'm attempting to see if a lat/long position is contained within certain boundaries on a google map.

I'm displaying my boundaries with a fusion table.

A straight up select from the fusion table results in my polygon data being returned:

https://www.googleapis.com/fusiontables/v1/query?sql=SELECT geometry FROM 1NosbtruuU4DH_tC2rtvTkFiMZfPNgL-HWUNx_Kk&key=mykey

When adding a WHERE clause with ST_INTERSECT to my query I get an error:

https://www.googleapis.com/fusiontables/v1/query?sql=SELECT geometry FROM 1NosbtruuU4DH_tC2rtvTkFiMZfPNgL-HWUNx_Kk&key=mykey WHERE ST_INTERSECTS(geometry,CIRCLE(LATLNG(-33.8977067,151.1944247),10))

The error is:

{
 "error": {
  "errors": [
   {
    "domain": "usageLimits",
    "reason": "keyInvalid",
    "message": "Bad Request"
   }
  ],
  "code": 400,
  "message": "Bad Request"
 }
}

Can anyone see what I'm doing wrong?


Solution

  • Your geographic data is in the column named geometry, not Lat:

    Change the Lat in the ST_INTERSECTS to geometry: https://www.googleapis.com/fusiontables/v1/query?sql=SELECT geometry FROM 1NosbtruuU4DH_tC2rtvTkFiMZfPNgL-HWUNx_Kk&key=mykey WHERE ST_INTERSECTS(geometry,CIRCLE(LATLNG(-33.8977067,151.1944247),10))

    Example Map

    You probably should read Warren Shen's response to your question in the Google Maps API v3 group also.