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

overpass API to download building data first draw #51

Closed
wants to merge 0 commits into from

Conversation

Emre-Yorat89
Copy link
Contributor

@Emre-Yorat89 Emre-Yorat89 commented Sep 7, 2024

Closes # (if applicable).

Changes proposed in this Pull Request

Checklist

  • I consent to the release of this PR's code under the GPLv3 license and non-code contributions under CC0-1.0 and CC-BY-4.0.
  • I tested my contribution locally and it seems to work fine.
  • Code and workflow changes are sufficiently documented.
  • Newly introduced dependencies are added to the main environment at PyPSA-Earth repository
  • Changes in configuration options are added in all of config.default.yaml and config.tutorial.yaml.
  • Add a test config or line additions to test/ (note tests are changing the config.tutorial.yaml)
  • Changes in configuration options are also documented in doc/configtables/*.csv and line references are adjusted in doc/configuration.rst and doc/tutorial.rst.
  • A note for the release notes doc/release_notes.rst is amended in the format of previous release notes, including reference to the requested PR.

@Emre-Yorat89
Copy link
Contributor Author

Hi, I have tested the retrieve_osm_data() function and it downloads buildings data without problem in .json format.
To try it you could delete earth osm function. (if I understood correctly, currently it tries to download all buildings inside a country and it does not finish in my case.)
It is just a first draw so I am looking forward to your responses and shape the PR according to your responses.
Note: The default coordinates contains zero building data. I suggest to increase the rectangular region in the config.yaml to see if it works.
Thank you.

Copy link
Member

@davide-f davide-f left a comment

Choose a reason for hiding this comment

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

Fantastic @Emre-Yorat89 :D
Great contributions and attached are some comments

@@ -96,7 +129,12 @@ def convert_iso_to_geofk(
out_path = Path.joinpath(store_path_resources, "out")
out_formats = ["csv", "geojson"]
new_files = os.listdir(out_path)

microgrid_coordinates = snakemake.config["microgrids_list"]["microgrid_1"]
Copy link
Member

Choose a reason for hiding this comment

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

This currently works for a microgrid only.
We should loop over all microgrids in microgrids_list to download the data for each microgrid independently and then put them together.
We can do this in two ways:

  • repeat the process, create a file for each microgrid and then merge all the files
  • make only a single overpass query and update the query "overpass_query" to account for the different microgrids. This basically means to add into the query the logic of searching in the box of the first microgrid or the box of the second microgrid and so on and so forth. I'm unsure this is possible but we can investigate

Copy link
Member

Choose a reason for hiding this comment

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

secondly, ideally, we should load the microgrid_list using params, as:
microgrids_list = snakemake.params.microgrids_list

beyond this, in the snakefile, under download_osm_data, we should add:

params:
    ...
    microgrids_list = config["microgrids_list"]

microgrid_coordinates = snakemake.config["microgrids_list"]["microgrid_1"]
features = "building"
overpass_url = "https://overpass-api.de/api/interpreter"
retrieve_osm_data(
Copy link
Member

Choose a reason for hiding this comment

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

Currently, the retrieve_osm_data function is executed after the standard approach.
It would be great to have an option and execute either the standard apporach or the novel one using overpass-api

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.

2 participants