How to render Multi-Response GeoJSON tiles
The so-called "multiresponse GeoJSON object" is not valid GeoJSON. Split the data before instantiating the Leaflet GeoJSON layers, e.g.:
// Assuming that you've already fetched the data off the network
var data = {
roads: {
type: "FeatureCollection",
features: .....
},
pois: {
type: "FeatureCollection",
features: .....
},
.......
};
for (var featureLayer in data) {
console.log(featureLayer); // e.g. "roads", "pois", etc
var geoJson = data[featureLayer]; // This is now a valid geojson object
// Now we can spawn Leaflet layers based on valid GeoJSON
var layer = L.geoJson(geoJson, {...}).addTo(map);
}
I am now using Tangram to display my tiles, Tangram
allows me to parse the composite response with no issues at all, it can identify the layers with just the name I supply, and it has good documentation and support.