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

Miscellaneous fixes #42

Merged
merged 5 commits into from
Jan 5, 2022
Merged

Miscellaneous fixes #42

merged 5 commits into from
Jan 5, 2022

Conversation

ehusby
Copy link
Contributor

@ehusby ehusby commented Jan 4, 2022

  • Argument paths that need to be wrapped in quotes (particularly those containing spaces) were using a deficient strategy to escape the quotes when passing the Python "task command" for running through taskhandler. Changed to a new strategy that should be less prone to error in the future.
  • Changed doesCross180 method of retrieving geometry point coordinates from old regex parsing of the WKT string to a more robust method of retrieving the coordinates through GDAL methods. The new method passes tests/unit_test_utils.py. Thanks @klassenjs!
  • Usage of the collections module in the utils.yield_task_args method is now backwards-compatible with Python2 so that we can test issues with Nunatak job scheduler that may be present when running with a Python3/GDAL3 Conda environment but not present when using the old module load gdal/2.1.3 environment.

Notes by Jim Klassen:

In GDAL 3.x `geom.ExportToWkt()` may return coordinates formatted as
integers (in the case that they actually fall on an integer).  Previous
GDAL versions appear to have always formatted the coordinates as floats
(with a decimal point).  This broke the regex used to parse the
x-coordinates out of the WKT.

For example, the `-72` below was being skipped by the regex:
```
POLYGON ((
-102.439166666667 -72.3713888888889 0,
-103.113055555556 -72.3983333333333 0,
-103.104166666667 -72.0288888888889 0,
-102.446388888889 -72 0,
-102.439166666667 -72.3713888888889 0
))
```

Instead of exporting to WKT and trying to parse the WKT into floats,
loop over the rings of the polygon and then the points of the rings
to extract the floating point X-coordinates directly using GetX().
Copy link
Contributor

@bakkerbakker bakkerbakker left a comment

Choose a reason for hiding this comment

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

Looks good, Erik!

@ehusby ehusby merged commit 9e034df into master Jan 5, 2022
@ehusby ehusby deleted the misc-fixes branch January 5, 2022 22:36
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