Closed ccma14 closed 1 year ago
Thanks @ccma14 this looks indeed like it should trim out empty geometries. I have a few questions:
lineLimit
and areaLimit
parameters are? I'm just wondering if we need to lower the threshold at all.removeEmpty
, I can see it basically runs through all of the features in a layer, computes length/area, and omits anything that doesn't meet the thresholds given. Do you think this might have any major performance implications? It's not completely the same computationally, but it reminds me a bit of shape simplification which was removed by default in fa739642a25736f363831224b06ff8cc4a30d3e9To address the concerns in terms of run time overhead and side effects from calling removeEmpty
, I've modified my patch such that we now use a small function that just filters out empty Geometries instead.
Thanks @ccma14, I just need to quickly make format
and get this merged down!
Description
This PR fixes an issue that causes tilenol to crash if a layer returned contains an empty geometry (stack trace below).
The issue is that tilenol attempts to Marshal layers into a gzipped MVT before storing it in the optional cache. However, Marshaling a Layer into a gzipped MVT via
mvt.MarshalGzipped
causes a panic if an empty geometry is encountered.This one-line fix adds a call to Layer.removeEmpty after retrieving it from the source, but before marshaling it for storage in the cache. This function also removes empty geometries (not just too small ones), and hence the issue is avoided.
Testing Done