-
Notifications
You must be signed in to change notification settings - Fork 25
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
Add to_geopandas() method #38
Conversation
pinging @scottyhq and @matthewhanson for review/comment. |
This looks good to me |
intake_stac/tests/test_catalog.py
Outdated
|
||
cat = StacItemCollection(stac_item_collection_obj) | ||
df = cat.to_geopandas() | ||
assert isinstance(df, gpd.GeoDataFrame) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we also assert that the new df has a few features that we expect (e.g. number or rows, index values, etc.)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. I added a few more tests to address this
Thanks @andersy005 for moving this forward. I think it's a helpful start, but we shouldn't close issue 36 yet because it would be great to have some sort of querying and indexing directly on the catalog as described by Joe Some other things to be aware of are changes to the STAC JSON that can affect this functionality. We should add tests that reflect the STAC version being used and maybe in the near future just enforce using STAC>0.9. It works currently because we're using @matthewhanson's satstac library which saves a self-contained STAC catalog as geojson "FeatureCollection" (which can be read by geopandas) - radiantearth/stac-spec#691 gf = gpd.GeoDataFrame.from_features(cat._stac_obj.geojson(), crs={'init' :'epsg:4326'}) Finally, we'll want to read CRS from the STAC catalog if it exists, and if not assign EPSG:4326 which is the usual. https://github.com/radiantearth/stac-spec/tree/master/extensions/projection How geopandas handles CRS might change in 0.7 geopandas/geopandas#1003 |
If I understand this correctly, extracting the CRS from the STAC catalog for catalogs that use the commons extension should be straightforward since the CRS is likely to be among the common metadata fields. What should we do in those cases where the commons extension is not used i.e. the CRS field is included on every Item? Do we just pick one item from the collection and assume that its CRS field is common for the rest of the items? |
Happy to work on this as part of this PR |
Thanks @andersy005! |
Towards #36