Thursday, November 11, 2010

Spatial Queries Added to Fusion Tables!

Google Fusion Tables now offers spatial queries. Using spatial queries, developers can find all features that are located within a given distance of a specified location, find all features that are located within a given bounding box, and find a given number of features closest to a location.

Bounding box queries take the form of:

SELECT * FROM 297050 WHERE ST_INTERSECTS(Address, RECTANGLE(LATLNG(37.2, -122.3), LATLNG(37.6, -121.9)))

Where 297050 is the key for your Fusion Table and the LATLNG coordinates represent the bounding box.

If you want to see how you can add buttons to a Google Fusion map that will load a spatial query I've created a quick example, World Crime Rates. This map shows world crime and homicide rates. The map has queries to view only countries with crime rates over certain figures. It also has two spatial queries - one to show results only from Europe and one that shows results from the Americas. The two spatial queries use the bounding box function.

You can learn more about the new spatial query offering in Fusion Tables in the Fusion Tables documentation.

Via: Search your geo data using spatial queries from Fusion Tables!

Post a Comment