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

r.timeseries.locations: add align option #67

Merged
merged 2 commits into from
Oct 18, 2024
Merged
Changes from all commits
Commits
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
16 changes: 13 additions & 3 deletions src/raster/r.timeseries.locations/r.timeseries.locations.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,13 @@
# % multiple: no
# %end

# %option G_OPT_R_INPUT
# % key: align
# % description: Raster map to align pixels with
# % required: no
# % multiple: no
# %end

# %option
# % key: domain_id
# % type: integer
Expand Down Expand Up @@ -322,8 +329,7 @@ def main():
"v.in.ogr",
flags="o",
# Until GDAL 3.6 is available UID and PWD have to be provided in the connection string
input=options["locations_url"]
+ f";Tables={schema}.{layer};UID={os.environ.get('MSSQLSPATIAL_UID')};PWD={os.environ.get('MSSQLSPATIAL_PWD')}",
input=options["locations_url"] + f";Tables={schema}.{layer}",
layer=layer if schema == "dbo" else f"{schema}.{layer}",
where=where + " AND " + options["where"] if options["where"] else where,
output=locations,
Expand All @@ -332,10 +338,11 @@ def main():
gs.vector.vector_history(locations, replace=True)

# Set computational region
gs.use_temp_region()
Module(
"g.region",
vector=locations,
align=continuous_subdivision_map,
align=options["align"] or continuous_subdivision_map,
ninsbl marked this conversation as resolved.
Show resolved Hide resolved
flags="g",
)

Expand Down Expand Up @@ -434,6 +441,9 @@ def main():
cursor.commit()
conn.close()

# Remove the temporary region
gs.del_temp_region()


if __name__ == "__main__":
options, flags = gs.parser()
Expand Down
Loading