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

feat: add project for street level imagery #980

Merged
merged 56 commits into from
Dec 12, 2024
Merged
Changes from 1 commit
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
6779347
feat(street): add street project draft fixture
ofr1tz Oct 29, 2024
40cdc66
feat: add new street project
Gigaszi Oct 29, 2024
33bc5ec
feat: add tutorial to street project
Gigaszi Oct 29, 2024
ec59ee0
refactor: move process_mapillary.py to utils
Gigaszi Oct 30, 2024
78f28df
feat: add functions to process mapillary data
Gigaszi Oct 30, 2024
3a7ac21
refactor: removed unused imports and classes
Gigaszi Oct 30, 2024
8e5c55c
feat: add function to convert input geojson to polygon
Gigaszi Oct 30, 2024
dd4e220
tests: add unittests for process_mapillary
Gigaszi Oct 30, 2024
b274af3
fix: wrong indention and patch in test_process_mapillary
Gigaszi Oct 30, 2024
7ec92ee
feat: add filtering and handling of mapillary response
Gigaszi Oct 30, 2024
97e552c
tests: add tests for filtering and handling of mapillary response
Gigaszi Oct 30, 2024
53dfda5
refactor: use mapillary incredentials in variables
Gigaszi Nov 11, 2024
481030c
refactor: reformat file process_mapillary.py
Gigaszi Nov 11, 2024
1187561
feat: add geometry to StreetTask and refactoring
Gigaszi Nov 11, 2024
0bef2e0
tests(street): use simpler geometry and add filter parameters to test…
Gigaszi Nov 11, 2024
789b027
refactor: tests for mapillary processing and street project
Gigaszi Nov 11, 2024
c1f1a79
fix: add missing parameter
Gigaszi Nov 11, 2024
a12a803
tests(street): add integration test for street project
Gigaszi Nov 11, 2024
2fb3bc7
tests(street): add street.json for testing of street project
Gigaszi Nov 11, 2024
14ff237
fix: test after refactoring
Gigaszi Nov 11, 2024
80ecf28
feat: add functions for spatial sampling and tests for it
Gigaszi Nov 11, 2024
984d821
feat: use filtering in street project
Gigaszi Nov 14, 2024
4ab528d
feat: add spatial sampling to street project
Gigaszi Nov 18, 2024
f7fc5f3
feat: add size restriction for too many images
Gigaszi Nov 18, 2024
f11f75e
breaking: change geom column in postgres to allow all geometry types
Gigaszi Nov 18, 2024
98f82c9
feat: save location of image as geometry
Gigaszi Nov 18, 2024
6a1d15e
feat: use spatial filter on downloaded images
Gigaszi Nov 18, 2024
05f1449
fix: adapt mapillary token entry in example env
ofr1tz Nov 28, 2024
263d738
fix: do not return failed_rows and do not use functions on empty df
Gigaszi Nov 28, 2024
5ac3620
Merge branch 'feature/street' of https://github.com/mapswipe/python-m…
Gigaszi Nov 28, 2024
df17d3c
fix: testing for removed funcionality
Gigaszi Nov 28, 2024
9f2ac81
style: code formatting
ofr1tz Nov 28, 2024
8593a3c
fix: fixed tests and removed return of failed rows for download from …
Gigaszi Nov 28, 2024
81d44ed
Merge branch 'feature/street' of https://github.com/mapswipe/python-m…
Gigaszi Nov 28, 2024
9503a7d
fix: tests for removed failing rows
Gigaszi Nov 28, 2024
c0016e2
style: fix flake8 errors and isort
ofr1tz Nov 28, 2024
2f3d523
style: isort
ofr1tz Nov 28, 2024
6ad174f
build: add requirements
ofr1tz Nov 28, 2024
315d239
build: add dummy mapillary key to github workflow
ofr1tz Nov 28, 2024
2b88cf7
fix: use os.getenv instead of os.environ
ofr1tz Nov 28, 2024
24c7eec
test: rename class and correct comments
ofr1tz Nov 28, 2024
7f46e80
fix: remove left overs of failed rows
Gigaszi Dec 3, 2024
652e885
Merge branch 'feature/street' of https://github.com/mapswipe/python-m…
Gigaszi Dec 3, 2024
bfa0818
fix: unittests for tile download
Gigaszi Dec 3, 2024
816b1e6
fix: add condition to raise valueerror if no features are found in aoi
Gigaszi Dec 3, 2024
f287b3a
fix: use mapillary api key secret in github workflow
ofr1tz Dec 3, 2024
020178d
fix: use square brackets with os.environ
ofr1tz Dec 3, 2024
dcaab3d
fix: add mapillary key to docker compose
ofr1tz Dec 3, 2024
8128488
fix: allow tasks with point geom in postgres
ofr1tz Dec 3, 2024
74064f8
fix: change geometry type in tasks table in initdb
Gigaszi Dec 3, 2024
f712340
Merge branch 'feature/street' of https://github.com/mapswipe/python-m…
Gigaszi Dec 3, 2024
729a4be
fix: change to all geometries in tasks table in setup db
Gigaszi Dec 3, 2024
994f398
fix: use lower case in setup db
Gigaszi Dec 3, 2024
57dc509
feat(django): add new project types to project type model
ofr1tz Dec 11, 2024
26c822c
fix: sort imports
ofr1tz Dec 11, 2024
4787dd4
fix: add new project types to schema.graphql
ofr1tz Dec 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: add size restriction for too many images
Gigaszi committed Nov 18, 2024
commit f7fc5f3123f1690e562e535a7a92324c54eea55e
16 changes: 10 additions & 6 deletions mapswipe_workers/mapswipe_workers/utils/process_mapillary.py
Original file line number Diff line number Diff line change
@@ -208,7 +208,6 @@ def filter_results(
return None
df = filter_by_timerange(df, start_time, end_time)


return df


@@ -235,10 +234,15 @@ def get_image_metadata(
)
if sampling_threshold is not None:
downloaded_metadata = spatial_sampling(downloaded_metadata, sampling_threshold)
if downloaded_metadata.isna().all().all() == False:
return {
"ids": downloaded_metadata["id"].tolist(),
"geometries": downloaded_metadata["geometry"].tolist(),
}
if downloaded_metadata.isna().all().all() == False or downloaded_metadata.empty == False:
if len(downloaded_metadata) > 100000:
err = (f"Too many Images with selected filter "
f"options for the AoI: {len(downloaded_metadata)}")
raise ValueError(err)
else:
return {
"ids": downloaded_metadata["id"].tolist(),
"geometries": downloaded_metadata["geometry"].tolist(),
}
else:
raise ValueError("No Mapillary Features in the AoI match the filter criteria.")
24 changes: 24 additions & 0 deletions mapswipe_workers/tests/unittests/test_process_mapillary.py
Original file line number Diff line number Diff line change
@@ -328,6 +328,30 @@ def test_get_image_metadata_no_rows(self, mock_coordinate_download):
with self.assertRaises(ValueError):
get_image_metadata(self.fixture_data, **params)

@patch("mapswipe_workers.utils.process_mapillary.coordinate_download")
def test_get_image_metadata_empty_response(self, mock_coordinate_download):
df = self.fixture_df.copy()
df = df.drop(df.index)
mock_coordinate_download.return_value = (
df,
None
)

with self.assertRaises(ValueError):
get_image_metadata(self.fixture_data)

@patch("mapswipe_workers.utils.process_mapillary.filter_results")
@patch("mapswipe_workers.utils.process_mapillary.coordinate_download")
def test_get_image_metadata_size_restriction(self, mock_coordinate_download, mock_filter_results):
mock_filter_results.return_value = pd.DataFrame({'ID': range(1, 100002)})
mock_coordinate_download.return_value = (
self.fixture_df,
None,
)

with self.assertRaises(ValueError):
get_image_metadata(self.fixture_data)


if __name__ == "__main__":
unittest.main()