felt/tippecanoe

Possible to aggregate all features at lowest zoom levels?

Opened this issue · 0 comments

Backstory

I have a dataset containing building footprints with an identifier (Name) and a height (height). I have an application wherein I would like to allow users to draw a polygon in order to select all buildings within that Polygon. By using the building identifiers, we can look up these buildings from another data source (outside the scope of this discussion) and display some aggregated information about these buildings.

Goal

We would like to have the Name properties available on as many zoom levels as possible. My thoughts are that this should be achievable via Tippecanoe + PMTiles and via making use of the --accumulate-attribute=Name:comma flag. I imaged that Tippecanoe would simplify and merge geometries but maintain the notion of all the unique buildings. However, I'm struggling to achieve this.

For the sake of illustration, we can use the Microsoft Canadian Building Footprints dataset of Prince Edward Island (link, this represents roughly the amount of polygons I'm dealing with in my real-world project, however is slightly less dense).

To mimic my real dataset, I've augmented the PEI dataset with a quick python script
import json, random, string
with open('/tmp/PrinceEdwardIsland.geojson', 'r') as f:
    data = json.load(f)
for feature in data['features']:
    feature["properties"]["Name"] = ''.join(random.choice(string.ascii_uppercase) for _ in range(8))
    feature["properties"]["height"] = random.randint(1,15)
with open('/tmp/PrinceEdwardIsland-augmented.geojson', 'w') as f_out:
    json.dump(data, f_out)

I've tried a number of techniques but can't seem to get it so that the number of Name values available in lower zoom levels equal the total number of unique buildings in the PEI dataset (76,590).

I've made a little CodePen UI to display the total number of Building IDs in all of the features (ie features.flatMap(feature => feature.properties.Name.split(',')).length), hoping I can get the value to equal 76590, however it seems like buildings are always dropped at lower zoom levels.

Some attempts:

Is what I'm attempting to do achievable? Any tips on how to get all of my features into extremely simplified and aggregated polygons or points at lower zoom levels?


Apologies if this isn't the best channel for this question or if I missed something obvious in the docs, I'm new to Tippecanoe (truly amazing tool, btw!)