I have a Google Map that pulls data from Fusion Tables and displays it. When you click on a polygon, the map zooms in and shows further polygons within that original polygon. This is accomplished using two separate Fusion Tables and some jquery.
My problem is trying to only show the polygons within the original polygon, not the entire set (for example, only showing the counties within the clicked state, not all counties in the US). The sub-polygons are stored using a code xxyy where xx is the original polygon and yy is the sub-polygon (so 1001 would be the 10th state and the first county within that state).
How, using the Fusion Tables "like SQL" script, can I pull only the sub-polygons with the first two digits of the code being equal to a specific number? Here's what I tried:
map.setOptions({
'query':
{
select: 'geometry',
from: ftnumber,
where: "'name' starts with " + stateCode
}
});
name being the column with the 4 digit code and stateCode being a variable that has the 2 digit code for the state stored in it.
I also tried:
map.setOptions({
'query':
{
select: 'geometry',
from: ftnumber,
where: "'name' like " + stateCode + "__"
}
});
The second option is preferable (if it's possible) as I could use that syntax to drill even further down if needed.
Final Solution:
query is
stateCodeHigh = stateCode + 100; map.setOptions({ 'query': { select: 'geometry', from: ftnumber, where: "name >= " + stateCode + " AND name < " + stateCodeHigh } });
Both of those queries should work if the 'name' column is of type String.
Check the type of the column by selecting Edit > Modify columns. Click on the 'name' column in the left-hand column. If the column isn't type Text, set the column to Text using the Type drop-down menu.