Feat: Add explicit container options for GeoJSON outputs#495
Conversation
isaacbrodsky
left a comment
There was a problem hiding this comment.
Thanks - the implementation looks good to me.
Could you add some tests to demonstrate this?
Thanks @isaacbrodsky! I've added a suite of unit tests in |
61de89c to
5404d22
Compare
|
@dyrpsf unfortunately after approving the test suite run, not only is the linter still failing, but there are failing tests, as well: https://github.com/uber/h3-py/actions/runs/29942829160/job/89001681729?pr=495#step:8:510 |
Thanks for the heads-up, @dfellis! I see the failed checks for both the linter and the test suite. I'm reproducing the errors locally right now so I can track down exactly what broke. I'll have a fix pushed shortly! |
5404d22 to
dd96a09
Compare
dd96a09 to
a2add15
Compare
|
Hey @dfellis, I just force-pushed the fixes! I added the explicit |
Was asleep when you sent that. Just triggered it. |
|
@dyrpsf so @ajfriend was very strict when he set up this repo :) https://github.com/uber/h3-py/actions/runs/29986675613/job/89269426447?pr=495#step:8:38 The test suite passes, but now it's no longer 100% code coverage, so you need more tests. |
Overview
This PR implements the
TODOnoted in_h3shape.pyregarding allowing users to specify strict GeoJSON containers when converting cells to geometries.Changes Made
Updated
h3shape_to_geoto accept acontainerargument. By default, it retains the'auto'behavior (returning the simplest validPolygonorMultiPolygon). However, it now supports wrapping the output into specific GeoJSON structures:MultiPolygon(safely wraps a standard Polygon)FeatureFeatureCollectionGeometryCollectionThis is particularly useful for downstream pipelines (like mapping libraries or databases) that require strict schema enforcement, such as always expecting a
FeatureCollectioneven if the query only returns a single cell.cc: @jongbinjung, @dfellis, @isaacbrodsky