Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature object with null geometry is not supported #195

Open
carstenpiepel opened this issue Oct 31, 2023 · 2 comments
Open

Feature object with null geometry is not supported #195

carstenpiepel opened this issue Oct 31, 2023 · 2 comments

Comments

@carstenpiepel
Copy link
Contributor

The GeoJSON spec supports "unlocated" Feature objects where the "geometry" member is a JSON null value. The Geo library simply ignores Features of this kind, even if they have their properties populated. A real-world web service that returns GeoJSON of this type is the National Weather Service Alert API, https://api.weather.gov/zones.

I looked into resolving this issue via a pull request but I am not comfortable contributing structural changes to the library without further discussion. I would appreciate help with this issue.

carstenpiepel added a commit to carstenpiepel/geo that referenced this issue Oct 31, 2023
@s3cur3
Copy link
Contributor

s3cur3 commented Aug 30, 2024

Sigh. Yeah, filtering these out was probably the wrong choice in #176—I knew at the time that the GeoJSON spec hinted that features with no geometry might be desired. I'll look into making these work.

@s3cur3
Copy link
Contributor

s3cur3 commented Aug 30, 2024

@carstenpiepel Thoughts on what the best way to handle this might be? My initial thought was a %GeometryCollection{} with an empty list of geometries, but the GeoJSON spec warns:

To maximize interoperability, implementations SHOULD avoid nested GeometryCollections.

Should we therefore implement a new struct like %Geo.Null{coordinates: nil, properties: %{}, properties: %{}}? It's... kind of ugly. 😕

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants