-
Notifications
You must be signed in to change notification settings - Fork 0
improved gadm setup with reworked pipe #448
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
base: dev
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
simplification_tolerance, preserve_topology=preserve_topology | ||
# we ensure that the areas of this countries match the area used in the excel sheet | ||
country_size_ha = { | ||
"USA": 947084624.2706754, |
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.
This seems evil. Why are we hardcoding areas for specific countries?
I guess these countries are the ones that we can now calculate stuff for.
What happens whenever the client gets more data for additional countries? We will be using the values computed below. It does not seem right
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.
As I said I don't want to risk that due to the country area numbers are different, the only way is using the same harcoded numbers Elena has. Where did she got them? No idea as is not in the original excel. The other country areas are calculated using an equal area projection.
|
||
def generate_sql_insert(rows: str) -> str: | ||
return f""" | ||
INSERT INTO public.countries |
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.
I thought we were using UPSERT?
Is it safe to only update the area (hardcoded or precomputed) and the geom:
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.
As far as I know an upsert in Postgres is resolve as an insert on conflict statement.
|
||
|
||
# 5. Write SQL to a file | ||
def write_sql_file(merged_gdf, output_file): | ||
def write_sql_file(merged_gdf: gpd.GeoDataFrame, output_file: str) -> None: |
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.
Where is this file being saved? Can't see any path reference so I assume it is writing it in the current path
However the new file is under /data/excel
. Is this the correct location?
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.
the sql statement is, the csv in in the raw_data/gadm folder.
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.
I checked the file. It's A LOT bigger now, is this ok?
Also, I have left some comments. I am concerned specially with the hardcoded area_ha values just for specific countries
let me know if the explanations are enough |
please review the generated files, so now i create a csv with hex wkb and the sql upsert statements