clickbar / laravel-magellan

A modern PostGIS toolbox for Laravel
MIT License
193 stars 11 forks source link

WIP: Adds FeatureCollection support #42

Closed iBotPeaches closed 1 year ago

iBotPeaches commented 1 year ago

So was digging for a cool package to help with some GeoJSON parsing in our Laravel app, found this and it error`d out on initial parsing with:

Invalid GeoJSON: The type FeatureCollection is not supported

Seeing how it was open source, I dove in to fix/add and I noticed maybe why it was left unresolved. Thankfully after the last few days of spending time with GeoJSON, I got the spec down pretty well.


Since Features are just a mixture of geometry and properties I figured this would be easy. Just supporting the existing parsing of geometry and a new parsing of custom key/value pairs.

Until I read the RFC. It says

A Feature object has a member with the name "properties". The value of the properties member is an object (any JSON object or a JSON null value).

So my idea of a simple key/value falls apart if you are allowed to have a JSON object (of any shape) or null.

However, as I started writing this. It was taking a good deal of changes to support introducing a new class that simply sub-classed Geometries and I felt a bit uneasy with how much I was changing.

Before I go further, may someone peek if I am going about this a wrong way or have any tips?

iBotPeaches commented 1 year ago

Just did the iterations/loops above this class. Closing.

saibotk commented 1 year ago

Hey 👋

First of all, thank you for raising a PR and doing a deep dive into the specifications 🫡

@ahawlitschek and me also want to address FeatureCollection at some point. We might try to do so rather sooner than later after seeing people having a use case for it.

Certainly if you still want to open a PR and provide some examples we are open to help you and work on a solution together 👌

Thanks for your work we appreciate it.