-
Notifications
You must be signed in to change notification settings - Fork 111
Feature/93 wms #94
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
Feature/93 wms #94
Conversation
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.
Small updates
README.md
Outdated
@@ -47,6 +47,8 @@ Before running any commands, it is necessary to create a `config.json` file to s | |||
- `imagery`: One of: | |||
- A template string for a tiled imagery service. Note that you will generally need an API key to obtain images and there may be associated costs. The above example requires a [Mapbox access token](https://www.mapbox.com/help/how-access-tokens-work/) | |||
- A GeoTIFF file location. Works with both local and remote files. Ex: `'http://oin-hotosm.s3.amazonaws.com/593ede5ee407d70011386139/0/3041615b-2bdb-40c5-b834-36f580baca29.tif'` | |||
- A WMS endpoint `GetMap` request. Fill out all necessary parameters except `bbox` which should be set as `{bbox}`. Ex: |
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.
Maybe link to what a WMS endpoint is?
@@ -86,6 +87,46 @@ def get_tile_tif(tile, imagery, folder, imagery_offset): | |||
|
|||
return tile_img | |||
|
|||
def get_tile_wms(tile, imagery, folder, imagery_offset): |
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'd add another 2-3 inline comments to the code within this function
if is_tif(imagery): | ||
return get_tile_tif | ||
if is_wms(imagery): | ||
return get_tile_wms |
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.
Add something like
else:
raise ValueError('Imagery type not understood')
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 current else
statement is the fallback function (there isn't a good test for non valid imagery string yet)
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.
If we don't test for it, shouldn't we at least catch bad imagery? Will download_tile_tms
work in most/all fallback cases?
You could also put download_tile_tms
in a try/except block just to print out a less cryptic error
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.
We won't really know if the imagery is bad or not until the downloading function fails
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.
Okay, sounds good
@@ -5,7 +5,7 @@ | |||
import numpy as np | |||
from PIL import Image | |||
|
|||
from label_maker.utils import url, class_match, get_tile_tif | |||
from label_maker.utils import url, class_match, get_tile_tif, get_tile_wms |
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.
Want to update the test for image fetching by testing get_image_function
instead of get_tile_tif
?
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 function to imagery string matching isn't ideal right now so I'd like it to remain untested for a bit (the tile "getter" functions themselves are the most important things to be reliable)
Close #93