3

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
    }
});
pbaris
  • 4,525
  • 5
  • 37
  • 61
Dead Man
  • 2,880
  • 23
  • 37
  • Why do you say you can't shorten the where clause? Can't you add a new column with a 2 or 3 character/digit unique code and replace col0 (county?)? Or use a [FIPS](http://en.wikipedia.org/wiki/FIPS_county_code) or other defined number? – geocodezip Oct 04 '13 at 12:56
  • 1
    A solution for this could be to create a view based on the above query. Then you just have to query the view. – davidkonrad Oct 04 '13 at 13:44
  • That query is dynamic so i can't create view based on any query. – Dead Man Oct 05 '13 at 04:58
  • @geocodezip I have tried 2 digit unique code for every county but when the counties increases in query, it also create the same Request-URI Too Large problem. – Dead Man Oct 05 '13 at 05:00

1 Answers1

3

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, e.g: 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.

sanya
  • 860
  • 1
  • 8
  • 20