Open prathik opened 9 months ago
@tidwall Just for context, we had inserted a polygon of this format in tile38 and on reading it - the panic caused the whole tile38 server to crash, so might be a good idea to fix this.
Hi, I recommend filing an issue in Tile38 that includes the commands that caused the server to crash. That would make it easier for me to diagnose and fix.
@tidwall I've raised it here - https://github.com/tidwall/tile38/issues/714
@tidwall I have added a check to prevent panics in the library, if I remove this check and you run the test, you can see the panic.
Do you have any recommendation on how we go about fixing this issue? If there are one set of coordinates with z coordinates and other without, they way the library handles it is to allocate the z coordinate values to the values that come first, instead of where the values actually should go.
I see few approaches:
Arrange the coordinates in such a way that those have a z value would go to the right place, however this might see an issue with linear ring polygons that have some z values and others don't
Assume a default z coordinate value if some have missing z values
Refactor the way we store the ex.values array so that it also knows which particular entry should get the z coordinate.