Reputation: 675
I have a problem with data visualization from fusion table. For example I have the next code:
function initialize() {
map = new google.maps.Map(document.getElementById('map_canvas'), {
center: new google.maps.LatLng(38.71980474264242, -121.552734375),
zoom: 5,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
fusionLayer = new google.maps.FusionTablesLayer({
query: {
select: 'column',
from: 'tableId',
where: "a huge where clause"
},
map: map
});
}
As you can see there I have a "huge where clause" in 'where' option of the query. But during initialization, google maps API performs a lot of GET requests to URI something like this:
http://mt1.googleapis.com/mapslt?hl=en-US&lyrs=ft:tableId|sc:'column'|sg:{huge_where_clause}&x=6&y=13&z=5&w=256&h=256&source=apiv3&token=74442
All of that requests fails with the status code 414: Request-URI Too Large.
So, my question: is it possible to query fusion table with huge where clauses or using POST requests instead of GET?
Upvotes: 4
Views: 625
Reputation: 4779
The GET URL's are limited to ~2k characters, and as you noted you can certainly create a complex WHERE clause that is longer, which causes this issue.
If you are just over the limit, one solution may be to rename your columns, so that they are less long.
Or, you maybe be able to simplify the query. As noted above this was one query that went over:
zip IN ('zip1', 'zip2', ..., 'zipN')
But you could potentially rewrite to save a lot of characters:
zip < zipN
Upvotes: 1