简体   繁体   中英

Request-URI Too Large (Fusion table layers Google Maps)

I am trying to put the fusion table layer data on my Google Map but I am getting an error Request-URI Too Large . I searched a lot but couldn't find how can I make it work either by POST method or something else. The problem is the where clause but I can't shorten the where clause. Is there anyone who can help me or guide me?

Thanks in advance for any help.

layer = new google.maps.FusionTablesLayer({
    map: googleMap,
    heatmap: {enabled: false},
    query: {
        select: "col4",
        from: "tableID",
        where: "",
    },
    styles: [{
        polygonOptions: {
            fillOpacity: 0.3
        }
    }, {
        where: "col0 in ('Jefferson','Pulaski','Los Angeles','Denver','Middlesex','New Castle','Duval','Pinellas','Lee','Broward','Fulton','Cobb','Ada','Tazewell','Cook','Marion','Hendricks','Putnam','Adams','Boone','Orleans','Plymouth','Baltimore','Washington','Macomb','Genesee','Oakland','Hennepin','Jackson','Shelby','Granite','Forsyth','Mecklenburg','Wake','Douglas','Gloucester','Passaic','Bernalillo','Sandoval','Clark','New York','Montgomery','Hamilton','Tulsa','Oklahoma','Multnomah','Lane','Chester','Philadelphia','York','Lehigh','Kent','Horry','Davidson','Travis','Harris','Dallas','Fairfax','Chesterfield','King','Brown','Laramie','Kalamazoo','Cabarrus','San Diego','Pennington','Richland','Weber','Ramsey','Hartford') AND col3 in ('AL','AR','CA','CO','CT','DC','DE','FL','GA','ID','IL','IN','WV','OH','KY','LA','MA','MD','MI','MN','MO','TN','MT','NC','NE','NJ','NM','NV','NY','OK','OR','PA','RI','SC','TX','VA','VT','WA','WI','WY','SD')",
        polygonOptions: {
            fillColor: '#ffffff',
            strokeColor: '#ff0000',
            fillOpacity: 0.3
        }
    }],
    options: {
        styleId: 1,
        templateId: 2
    }
});

Once your working with dynamic queries you' ll always hit the Request URI Too Large issue. One solution is to generate the fusion table you're querying runtime - meaning after the user selects the dynamic parameters you create the table..or more likely a view from server side (php, asp, java)- and pass the created table id to the view layer in your application. The downside is: you'll loose all dynamics since after creation the table needs to be cached on google's side to display properly (another 5-30 sec on top of table creation).

Hear my advise: FT is just not designed to display dynamically filtered data. Some small filters can be applied, eg: filtering on a single field's single value, but that's it. To achieve what you want, you might want to consider an OpenLayers + GeoServer + WMS approach. These are open source and ~100x faster than the workaround above.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM