felt / geo

A collection of GIS functions for Elixir
MIT License
620 stars 85 forks source link

Multi Linestring with 'EMPTY' in the point throwing error #167

Open jnylen opened 2 years ago

jnylen commented 2 years ago

Hi,

Lovely lirary but we are having an issue with MULTILINESTRINGs where it includes "EMPTY" in it similar to:

SRID=4326;MULTILINESTRING((17.3184738535347 60.7864700694704,17.3180661577644 60.7874544933595),EMPTY,EMPTY)

It would then throw this error:

** (DBConnection.ConnectionError) client #PID<0.2818.0> stopped: ** (FunctionClauseError) no function clause matching in anonymous fn/2 in Geo.WKB.Decoder.do_decode/4
    (geo 3.4.2) lib/geo/wkb/decoder.ex:121: anonymous fn(1, <<1, 2, 0, 0, 0, 0, 0, 0, 0>>) in Geo.WKB.Decoder.do_decode/4

The line in the log are kinda incorrect. The lines that matter are these: https://github.com/bryanjos/geo/blob/master/lib/geo/wkb/decoder.ex#L108-L111

bryanjos commented 2 years ago

Hi, thanks for bringing this up. I didn't know EMPTY was a thing. I can look into it but I will also take any PRs to resolve this.

jnylen commented 9 months ago

@bryanjos still receiving this, is this being looked into? Should I take a look at it?

s3cur3 commented 1 week ago

@jnylen If you'd like to submit a PR, that'd be awesome. I'm not sure what the expected behavior here would be—do we stick nil values in the multilinestring's coordinates, or just remove the empty values?