2

I'm trying to add multiple map layers to the same map but I can currently only display one or the other. I've narrowed it down to the "map: map" line and when I comment out one, the other shows. I have to have two layers in this case so how do I get them both to display? Thanks in advance.

//Add layers
    layer1 = new google.maps.FusionTablesLayer({
        query: {select: 'Address', from: tableid1},
        styles: styles[0],
        //map: map <-- When commented, the other one displays
    });

    layer2 = new google.maps.FusionTablesLayer({
        query: {select: 'Address',from: tableid2},
        styles: styles[0],
        map: map
    });
Layne
  • 642
  • 1
  • 13
  • 32

2 Answers2

3

I think your problem may be that you are trying to load two FusionTables that both reference styling rules. From the FusionTables section of the Developer's Guide:

You can use the Maps API to add up to five Fusion Tables layers to a map, one of which can be styled with up to five styling rules.


You may also want to double-check that you are not exceeding any of the additional limits that Google places on FusionTable usage:

  • Only the first 100,000 rows of data in a table are mapped or included in query results.
  • Queries with spatial predicates only return data from within this first 100,000 rows. Therefore, if you apply a filter to a very large table and the filter matches data in rows after the first 100K, these rows are not displayed.

When importing or inserting data, remember:

  • The total size of the data sent in one API call cannot exceed 1MB.
  • A cell of data in Fusion Tables supports a maximum of 1 million characters; it may sometimes be necessary to reduce the precision of coordinates or simplify polygon or line descriptions.
  • The maximum number of vertices supported per table is 5 million.

When looking at the map, you may notice:

  • The ten largest-area components of a multi-geometry are shown.
  • When zoomed farther out, tables with more than 500 features will show dots (not lines or polygons).
Sean Mickey
  • 7,618
  • 2
  • 32
  • 58
  • Ahh, that got both layers to display but only one of them has the styles applied. So then how do I get my styles to apply to maps with so many points they require two layers? – Layne May 16 '12 at 16:24
  • It looks like a limitation of the API. – Layne May 16 '12 at 16:36
  • Well, yes, a deliberate limitation that they have implemented as a way to control load on the FusionTables. In your case, I guess I would style the portion that is most prominent, but then just deal with the fact that the other content may not be styled. It does seem harsh, but it _is_ a lot of good data at no cost. – Sean Mickey May 16 '12 at 17:20
  • Certainly not complaining considering how much I've paid for the service! Plan B it is. – Layne May 16 '12 at 18:19
  • Well, at least you know. And I'm not being pushy, but I noticed you are a fairly new member - it's customary to accept an answer by clicking the checkmark next to the question if you believe it addressed your question. And if you like the answer because you feel it was a high quality answer, you may also choose to upvote the answer by clicking the up arrow above the vote counter. It benefits us both and also helps other developers to know that your question has been answered. Glad to have helped you - – Sean Mickey May 16 '12 at 19:01
0

I added some information about styling and marker icons in a Question a while back titled "styling icons markers - fusion tables" which I think you can see here: styling icons markers - fusion tables.

In brief, you can set styles in your JS, as you have done, or you can set styling directly inside your fusion table -- including assigning different markers, polygon colors, etc. Pls see the earlier Question for an example of how to do this.

BTW, you are not limited to styling just one table when you do the styling inside the fusion tables.

Cheers, Wendy

Community
  • 1
  • 1
wendysmith
  • 67
  • 2
  • 9