mapbox / tippecanoe

Build vector tilesets from large collections of GeoJSON features.
BSD 2-Clause "Simplified" License
2.71k stars 429 forks source link

Tippecanoe metadata file ignoring columns with only null values #822

Open stdmn opened 4 years ago

stdmn commented 4 years ago

@ericfischer I'm not sure if this is a feature or a bug, but I've been automating the process of converting geojson to tiles using real life (ie, messy) datasets. One thing I've found is that when a field contains only null values for all features, Tippecanoe adds the field to each feature, but ignores the data for the metadata file.

This is a problem for me, as I use the metadata file to format the information from each feature when a feature is selected. I tried using the -pe tag to see if it would retain the column in the metadata, but that didn't seem to do what I was hoping.

I've attached an example zip file which contains two JSON files--an example input JSON and an output metadata file--so that you can try it for yourself. You'll note that a few of the fields are ignored in the metadata but still show up for each feature.

Example input JSON & metadata: example.zip

Here's the exact command I'm using if that helps: tippecanoe -f --tile-stats-values-limit=100 -Z9 -Q -z14 -M 2500000 -aN -aD -pS -rg -e <OUTPUT DIR> -ag <INPUT FILE>

e-n-f commented 4 years ago

Thanks for the report. Nulls have been kind of neglected because they aren't supported by the vector tile format and therefore can't appear in tiles, but by now make it fairly far along the tiling pipeline so they can be used in conditionals, but still not quite far enough for what you are wanting to do. I'll try to figure out whether I can preserve them a little further.

e-n-f commented 4 years ago

I think this is the change you are looking for: https://github.com/mapbox/tippecanoe/pull/825

I'm still not sure whether it is the right thing to do, when the nulls are not actually represented in the tiles.

stdmn commented 4 years ago

This would be immensely helpful. Even if it's just an option that you can include (-nu, --tilestats-include-nulls)