-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expand capability of geojson class (#694)
* put uo-des geojson methods into main gmt geojson class * break out urbanopt_load class to its own file * add types and returns for mypy * remove what mypy said was unnecessary type hinting * add error catching in geojson class * WIP tests for methods moved into geojson class from uo-des repo * add logging, errors, and a docstring comment to geojson class * finish adding tests for geojson class * add empty files to force testfolder creation on windows * test getting site lat/lon from geojson * improve docstring for geojson lat-lon method * write to log, do not print * comment out exception raising on getting meters --------- Co-authored-by: Nicholas Long <[email protected]>
- Loading branch information
Showing
9 changed files
with
308 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
class GeoJsonValidationError(Exception): | ||
pass | ||
|
||
|
||
class UrbanOptLoad: | ||
"""An UrbanOptLoad is a container for holding Building-related data in a dictionary. This object | ||
does not do much work on the GeoJSON definition of the data at the moment, rather it creates | ||
an isolation layer between the GeoJSON data and the GMT. | ||
""" | ||
|
||
def __init__(self, feature): | ||
self.feature = feature | ||
self.id = feature.get("properties", {}).get("id", None) | ||
|
||
# do some validation | ||
if self.id is None: | ||
raise GeoJsonValidationError("GeoJSON feature requires an ID property but value was null") | ||
|
||
def __str__(self): | ||
return f"ID: {self.id}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.