felt / geo

A collection of GIS functions for Elixir
MIT License
630 stars 88 forks source link

GeoJSON coordinates are not check nor converted to a numeric value #175

Closed LostKobrakai closed 4 weeks ago

LostKobrakai commented 2 years ago

When creating a new integration a co-worker of mine sent coordinates as strings in the GeoJSON format. The spec is not really clear in defining the concrete JSON type required, but calling it decimal type.

A position is an array of numbers. There MUST be two or more elements. The first two elements are longitude and latitude, or easting and northing, precisely in that order and using decimal numbers. Altitude or elevation MAY be included as an optional third element.

I'd expect geo to either parse string values to float (or Decimal) or fail to decode if the coordinates are strings. The first option is likely more correct.