tile38 icon indicating copy to clipboard operation
tile38 copied to clipboard

Vector tile output for search results

Open bt-maps opened this issue 2 years ago • 4 comments

Describe the solution you'd like Add option to return vector tile output (mvt/.pbf) on search results. Having the ability to generate mvt directly in tile38 like PostGIS's asMVT() function would be a great feature.

Describe alternatives you've considered Clipped geojson from tile38 ---- geojson to pbf middleware -- client-side js renderer.

Additional context

https://github.com/mapbox/vector-tile-spec

bt-maps avatar Apr 16 '22 01:04 bt-maps

I agree 100%. I created a little mvt project a little while back for this purpose exactly. I haven't gotten around to putting it into Tile38 yet.

tidwall avatar Apr 19 '22 00:04 tidwall

for reference: https://github.com/tidwall/mvt

tidwall avatar Apr 21 '22 20:04 tidwall

Thanks. No external dependencies! Nice! I really need to to learn Go sometime soon so I can try to contribute.

bt-maps avatar Apr 21 '22 21:04 bt-maps

I wrote the mvt library 4 years ago, yet I still haven't added it to tile38... 😭

The dev branch for the mvt feature will be at here.

The idea will be that you can do an INTERSECTS with the MVT x y z option.

INTERSECTS fleet MVT 513 412 12

Which works the same as TILE 513 412 12 but instead of returns a list of geojson objects, it'll return the mvt binary.

For JSON the output will be:

{"ok":true,"mvt":"...base64...","count":100}

Where "count" is the number of features represented in the mvt. This can be raised or lowered using LIMIT number. Default is 100.

For RESP the output will be two values:

1) (integer) 100
2) ...rawmvtbinary...

The current branch work and produces a working mvt tile, but the mvt does not contain any features yet. This will take a little work because there're certain decisions that still need to be made. Such as what default extent to use? I'm thinking 4096 is good. Also how much margin? Which will affect our clipping algorithm. Also dealing with tagging and layer naming is important.

Fortunately the tidwall/mvt has all the features.

tidwall avatar Apr 21 '22 22:04 tidwall