微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

javascript-请求URI太大(融合表图层Google Maps)

我正在尝试将融合表图层数据放到我的Google Map上,但出现错误Request-URI Too Large.我进行了很多搜索,但找不到如何通过POST方法或其他方法使其工作.问题是where子句,但是我不能缩短where子句.有谁可以帮助我或指导我?

在此先感谢您的帮助.

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
    }
});

解决方法:

使用动态查询后,您将始终遇到Request URI Too Large问题.一种解决方案是生成查询运行时的融合表-这意味着在用户选择创建表的动态参数之后.或更可能是从服务器端查看(PHP,asp,java)的视图,然后传递创建的表ID到应用程序中的视图层.缺点是:您将失去所有动态,因为创建后,该表需要缓存在Google一侧以正确显示(在创建表的顶部还需要5到30秒).

听听我的建议:FT并非旨在显示动态过滤的数据.可以应用一些小的过滤器,例如:对单个字段的单个值进行过滤,仅此而已.
为了实现所需的功能,您可能需要考虑使用OpenLayers GeoServer WMS方法.这些是开源的,比以上解决方法快100倍.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐