本文介绍了定型融合表层多边形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个具有5个人口(列)的融合表,对于每个人,我要显示具有不同颜色的最高人口密度的多边形。

I have a fusion table with 5 populations (columns), for each these I want to display the polygons with the highest concentration of population in a different color.

在样式融合表图层的示例中,定义了polygonOptions,但是我不想要多边形有任何样式,除非有一个人口的集中,并且也因为这将采取1样式远离极限5。

In the example for styling fusion table layers, the "polygonOptions" was defined, but I don't want the polygons to have any styling unless there's a concentration of one of the populations, and also because that would take 1 style away from the limit of 5.

我不确定要更改什么或缺少什么以使这些样式正确显示。

I'm not sure what to change or what I'm missing to have these styles display correctly.

我的地图:

推荐答案

第一个问题是列名,当它们包含空格时,必须用单引号查询。

The first problem you have are the column-names, when they contain whitespaces, you must wrap them in single-quotes inside the query.

另一个问题(您需要应用6个样式,但限制为5个)。您还可以直接为地图创建样式,因此您可以创建一个将所有多边形的不透明度设置为0的虚拟样式。

The other issue(that you need to apply 6 styles but there is a limit of 5). You also may create styles directly for a map, so you may create a dummy-style that sets the opacity of all polygons to 0.

要应用此样式,请使用ID的样式,并将其与options-parameter传递给图层。我为你的地图创建了这样一个虚拟样式,它有ID 4

To apply this style use the ID of the style and pass it with the options-parameter to the Layer. I've created such a dummy-style for your map, it does have the ID 4

创建现在应该如下所示:
var layer1 = new google.maps.FusionTablesLayer({

The layer-creation now should look like this:var layer1 = new google.maps.FusionTablesLayer({

  query: {
    select: 'geometry',
    from:   '1PM3_L795Eus1HXCylF6UM0tLqXarnkNZeB_LmM8'

  },
  options: {
        styleId: 4
      },
  styles: [
     {
        where: "'Puerto Rican Population' > 500",
    polygonOptions: {
     fillColor: "#46A2D1", //blue
     fillOpacity: 0.7}
     },
   {
        where: "'Cuban Population' > 500",
    polygonOptions: {
     fillColor: "#F29400", //orange
     fillOpacity: 0.7 }
     },
     {
        where: "'Bahaman Population' > 100",
    polygonOptions: {
     fillColor: "#BAC200", //yellow
     fillOpacity: 0.7}
     },
     {
        where: "'Dominican Population' >200",
    polygonOptions: {
     fillColor: "#E068A0", //pink
     fillOpacity: 0.7 }
     },
     {
        where: "'Haitian Population' > 500",
    polygonOptions: {
     fillColor: "#66A919", //green
     fillOpactity: 0.7}
   }
    ]
});

测试:

与评论相关

您使用的栏名称不正确。

you are using wrong column-names.

有关:

'Nicaraguan' -> 'Nicaraguan Population'

对于:

'Venezuelan Population'  ->'Venzuelan Population
'Peruvian'               ->'Peruvian Population'
'Argentinian Population' ->'Argentinean Population'

这篇关于定型融合表层多边形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 04:40