Huge offer

I have a problem visualizing data from a fusion table. For example, I have the following 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, I have the "huge space" option in the "where" option. But during map API initialization, google makes many GET requests for URIs 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 these requests are not executed with status code 414: Request-URI Too Large.

So my question is: is it possible to query a fusion table with huge suggestions or use POST requests instead of GET?

+4
source share
1 answer

The GET url is limited to ~ 2k characters, and as you noted, you can create a complex WHERE clause that is larger, which causes this problem.

If you just exceeded the limit, one solution might be to rename your columns so that they are shorter.

Or maybe you can simplify the request. As noted above, this was one request that crossed:

 zip IN ('zip1', 'zip2', ..., 'zipN') 

But you can rewrite to save a lot of characters:

 zip < zipN 
+1
source

Source: https://habr.com/ru/post/1439164/


All Articles