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

Improve geometry-related validation in Scene and GeoJSONVectorSource and fix a bug in AoiSampler #1856

Merged
merged 4 commits into from
Aug 9, 2023

Conversation

AdeelH
Copy link
Collaborator

@AdeelH AdeelH commented Aug 8, 2023

Overview

This PR makes some fixes motivated by #1855:

  • Adds a validation check for AOI polygons to ensure that they are in fact polygons and not some other type of geometry
  • Makes it so that the CRS key (if present) in the GeoJSON dict read by GeoJSONVectorSource is deleted. This is to avoid discrepancies in case the GeoJSON is subsequently passed to code that does respect the CRS field (e.g. geopandas).
  • Fixes compatibility issues with shapely v2.0 in AoiSampler

Checklist

  • Added needs-backport label if PR is bug fix that applies to previous minor release
  • Ran scripts/format_code and committed any changes
  • Documentation updated if needed
  • PR has a name that won't get you publicly shamed for vagueness

Testing Instructions

  • See new unit tests.

@AdeelH AdeelH changed the title Improve geometry-related validation Improve geometry-related validation in Scene and GeoJSONVectorSource Aug 8, 2023
To avoid discrepancies if the geojson is passed to code that *does* respect the crs field (e.g. geopandas).
@codecov
Copy link

codecov bot commented Aug 9, 2023

Codecov Report

Merging #1856 (9109320) into master (dc23f1f) will increase coverage by 0.10%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #1856      +/-   ##
==========================================
+ Coverage   80.67%   80.78%   +0.10%     
==========================================
  Files         188      188              
  Lines        9244     9260      +16     
==========================================
+ Hits         7458     7481      +23     
+ Misses       1786     1779       -7     
Files Changed Coverage Δ
rastervision_core/rastervision/core/data/scene.py 100.00% <100.00%> (ø)
...n/core/data/vector_source/geojson_vector_source.py 100.00% <100.00%> (ø)
...ision/pytorch_learner/dataset/utils/aoi_sampler.py 97.59% <100.00%> (+8.70%) ⬆️

@AdeelH AdeelH marked this pull request as ready for review August 9, 2023 18:05
@AdeelH AdeelH merged commit ee3fbef into azavea:master Aug 9, 2023
1 check passed
@AdeelH AdeelH changed the title Improve geometry-related validation in Scene and GeoJSONVectorSource Improve geometry-related validation in Scene and GeoJSONVectorSource and fix a bug in AoiSampler Aug 9, 2023
@AdeelH AdeelH deleted the geom branch August 9, 2023 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant