maptiler / tileserver-gl

Vector and raster maps with GL styles. Server side rendering by MapLibre GL Native. Map tile server for MapLibre GL JS, Android, iOS, Leaflet, OpenLayers, GIS via WMTS, etc.
https://tileserver.readthedocs.io/en/latest/
Other
2.19k stars 632 forks source link

Provide POST endpoint to work around long path query arg #408

Open lsiden opened 4 years ago

lsiden commented 4 years ago

Tileserver-gl static API correctly responds with 413 when given a path=... query argument that exceeds some limit I have not yet taken the time to determine. I propose adding a POST method that will accept the path argument in its body encoded as JSON.

I have an app that at times needs to draw long and complicated boundaries whose string length that exceeds whatever the limit is.

I was reluctant to propose a POST endpoint to get a static resource, but was encouraged by the article "It's Okay to Use POST" in response to my question on StackOverflow.

An alternative approach would be for me to calculate the bounding box and request the map image from the static API without the 'auto' path element, then have the client app composite the boundaries over the returned image, but I would like to take advantage of tileserver-gl's existing capabilities as much as possible so as not to duplicate code.

My client app draws other artifacts over the map it gets back from tileserver-gl. Having tileserver-gl draw a path first lets me confirm that my own conversions from geographical to pixel coordinates match those of tileserver-gl by compositing artifacts directly over path vertices using the same lat/lng coordinates.

Please advise whether you would consider a push-request that implements this proposal.

stadelmanma commented 4 years ago

@petrsloup (or anyone else on the team) if I can find the time to draft a PR for this feature would it be considered? I'm building an application that plots running route GPS traces and desperately need the ability to do long paths, preferably without needing to implement it myself.

Thanks for providing this awesome mapping server!