mapbox / tile-count

A tool for accumulating point counts by tile
BSD 2-Clause "Simplified" License
32 stars 10 forks source link

Any chance to include geojson properties? #49

Open ricadete opened 6 years ago

ricadete commented 6 years ago

First of all, awesome work with this library! For my application i will need to use properties for data-drive visualisation (color, size, ...) , therefore is it important to maintain the properties while running tile-count-create and tile-count-tile.

Question: It is possible to tweak this library to include custom properties, not just density? So, while doing the merge for different zoom levels, and in case of different properties at the geojson, they would merge as array of values (e.g. properties.users: [24,66,94]).

Maybe you know a better way, let me know, thanks.

e-n-f commented 6 years ago

It would be useful to be able to support some properties, but I think general GeoJSON support is going to be out of scope for this project.

Historical background: My first tool along these lines was datamaps, which supported a single integer property for each feature. I made a couple of attempts to add support for arbitrary properties, but eventually decided it was too much of a mess and gave up and wrote Tippecanoe instead. Then still later I went back to make tile-count, to optimize for the one case that datamaps handled really well but that overwhelmed Tippecanoe.

I will probably go back and add angle-and-magnitude attribute support to tile-count, since it is useful for tracking the direction and speed of travel, and has well-defined semantics for averaging points together. But if I add a feature like you are asking for, it will almost certainly be in Tippecanoe instead.

The other hard part of this is that the vector tile format does not support array attributes, so a combined attribute like you ask for would have to be generated as a string containing the array instead. With luck this will get fixed in the next vector tile spec revision.