Skip to content

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

Merged
merged 12 commits into from
Jul 24, 2018
Merged

Feature/93 wms #94

merged 12 commits into from
Jul 24, 2018

Conversation

drewbo
Copy link
Contributor

@drewbo drewbo commented Jul 19, 2018

Close #93

@drewbo drewbo requested a review from wronk July 19, 2018 17:54
Copy link
Contributor

@wronk wronk left a 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:
Copy link
Contributor

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):
Copy link
Contributor

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
Copy link
Contributor

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')

Copy link
Contributor Author

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)

Copy link
Contributor

@wronk wronk Jul 24, 2018

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

Copy link
Contributor Author

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

Copy link
Contributor

@wronk wronk Jul 24, 2018

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
Copy link
Contributor

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?

Copy link
Contributor Author

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)

@wronk wronk merged commit a818003 into master Jul 24, 2018
@wronk wronk deleted the feature/93-wms branch July 24, 2018 16:24
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