Skip to content

Conversation

@BharatVe
Copy link
Collaborator

@BharatVe BharatVe commented Mar 26, 2025

Closes #61
Closes #105
Closes #48

  • Added a new download_geojson view in publications/views.py that serializes Publication objects to GeoJSON.
  • Registered the /download/geojson/ endpoint in publications/urls.py.
  • Provided a button in the UI that allows users to download the GeoJSON file.

@nuest nuest changed the title Changes for testing warnings with js GeoJSON Download Mar 26, 2025
@BharatVe BharatVe marked this pull request as ready for review April 9, 2025 12:43
@nuest
Copy link
Member

nuest commented Apr 9, 2025

@BharatVe Please use pygdal functions for the tests, instead of importing from osgeo

@nuest
Copy link
Member

nuest commented Apr 9, 2025

@BharatVe because we only use fiona in tests, you can instead add it to requirements-dev.txt, to reduce the footprint of the regular app.

@BharatVe
Copy link
Collaborator Author

I can move it, but I was also using the Osgeo in the views.py file ( which was not causing any issues with the unit test earlier), so I didn't modify it. However, in the last unit test, it was also causing the error, so I can use Fiona in the views.py as well to solve this issue( and hence put it in requirements.txt) but I can move it to the dev file.

Copy link
Member

@nuest nuest left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @BharatVe ! This is a solid first attempt but needs quite a bit more work before it can be merged.

@nuest nuest changed the title GeoJSON Download Download GeoJSON and GeoPackage Apr 16, 2025
@BharatVe BharatVe marked this pull request as draft April 22, 2025 19:09
@BharatVe
Copy link
Collaborator Author

Hi Daniel,

I ran into the same import error in CI that I had locally avoided by falling back to Fiona: our unit tests on GitHub Actions can’t import osgeo because the GDAL C library and Python bindings aren’t installed in the runner environment by default. Locally GDAL is already present on my machine, so everything passes, but the CI environment needs an explicit setup step.

I believe a solution for this is to add

- name: Install GDAL system library run: | sudo apt-get update sudo apt-get install -y gdal-bin libgdal-dev

in the GitHub Actions workflow. Would it be alright if I did that. The other option is to stick with the Fiona based approach.

Copy link
Member

@nuest nuest left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please give another optiona a try: add gdal to the requirements.txt (see https://pypi.org/project/GDAL/) and remove the installation of python3-gdal from workflows/ci.yml. Maybe that installs GDAL successfully.

@nuest nuest force-pushed the enhancement/Download_all_geometries_and_metadata_as_GeoJSON_61 branch 2 times, most recently from b7186f7 to cc7994d Compare April 29, 2025 07:35
@nuest nuest force-pushed the enhancement/Download_all_geometries_and_metadata_as_GeoJSON_61 branch from cc7994d to 939e0b8 Compare April 29, 2025 07:44
@nuest
Copy link
Member

nuest commented May 6, 2025

@BharatVe There are many unresolved conversations up there, many of which are likely outdated. Please go through all of them an mark them as resolved so we can move on with the remaining 2-3 actual issues. Thanks!

Copy link
Member

@nuest nuest left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one more small change request, but I kindly ask you to fix that in a new PR, so we can finally get your first real contribution into the code. 🥳

geopackage_size = humanize.naturalsize(os.path.getsize(gpkg_path), binary=True)
else:
geopackage_size = None
ts = os.path.getmtime(json_path)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You only take the time of one format here, which is fine because all files should be created at he same time. However, what if they are not?

Please load the times of all files here and compare them that they are about the same time, within an hour is fine. Add a log statement here with level warning if the difference is more than an hour.
The code can then proceed as it is, but at least we have a hint in the logs that something may be wrong.

@nuest nuest marked this pull request as ready for review May 15, 2025 08:17
@nuest nuest merged commit a08856b into main May 15, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants