-
Notifications
You must be signed in to change notification settings - Fork 8
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
Service URL key checking and enhance xml parsing performance for WMS layers #103
Conversation
Close this to fix the style problem as my local machine didn't flag me the error. Will reopen again. |
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.
Reviewed 1 of 1 files at r2.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @barryytm, @dan-bowerman, and @james-rae)
services/regparse/ogc.py, line 2 at r2 (raw file):
import requests import xml.etree.ElementTree as ETree
How does etree enhance parsing with respect to minidom?
services/regparse/ogc.py, line 59 at r2 (raw file):
def str2bool(v):
str2bool
looks like a single use utility function; if it isn't needed anymore it should be removed (but please ensure the output of layer.attrib
is a boolean type before doing so)
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.
Reviewable status: 0 of 1 files reviewed, 2 unresolved discussions (waiting on @alyec, @barryytm, @dan-bowerman, and @james-rae)
services/regparse/ogc.py, line 2 at r2 (raw file):
Previously, alyec (Aly Merchant) wrote…
How does etree enhance parsing with respect to minidom?
Tried http://geo.weather.gc.ca/geomet/?lang=E&SERVICE=WMS&REQUEST=GetCapabilities on minidom and it was timed out. https://wiki.python.org/moin/MiniDom suggested to use elementTree and it worked.
Here is a JSON snippet for testing:
{
"fr": {
"feature_info_format": "text/plain",
"service_url": "http://geo.weather.gc.ca/geomet/?lang=F",
"service_type": "ogcWms",
"legend_format": "image/png",
"scrape_only": [
"HRDPS.CONTINENTAL_NT"
],
"service_name": "HRDPS.CONTINENTAL - Total cloud cover (fraction)"
},
"en": {
"feature_info_format": "text/plain",
"service_url": "http://geo.weather.gc.ca/geomet/?lang=E",
"service_type": "ogcWms",
"legend_format": "image/png",
"scrape_only": [
"HRDPS.CONTINENTAL_NT"
],
"service_name": "HRDPS.CONTINENTAL - Total cloud cover (fraction)"
},
"version": "2.0"
}
services/regparse/ogc.py, line 59 at r2 (raw file):
Previously, alyec (Aly Merchant) wrote…
str2bool
looks like a single use utility function; if it isn't needed anymore it should be removed (but please ensure the output oflayer.attrib
is a boolean type before doing so)
Sorry, forgot to put that back. Done, thanks
This comment is for heartbeat as my reply in reviewable didn't trigger it. |
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.
Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @alyec, @barryytm, @dan-bowerman, and @james-rae)
services/regparse/ogc.py, line 79 at r3 (raw file):
id = id.text title = layer.find(namespace + 'Title').text queryable = str2bool((layer.attrib)['queryable'])
I believe queryable is optional. Have you tested the str2bool
version with a capabilities file that has queryable
missing on some nodes?
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.
Reviewed 1 of 1 files at r3.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @barryytm, @dan-bowerman, and @james-rae)
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.
Reviewed 1 of 1 files at r3.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @barryytm and @james-rae)
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.
Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @alyec, @dan-bowerman, @barryytm, and @james-rae)
services/regparse/ogc.py, line 79 at r3 (raw file):
Previously, alyec (Aly Merchant) wrote…
I believe queryable is optional. Have you tested the
str2bool
version with a capabilities file that hasqueryable
missing on some nodes?
I've changed it to use get()
instead, and it returns None
if not found. I have also made str2bool return False
if the value is None
. Therefore if queryable is missing, str2bool will return False
. Thanks.
This comment is to trigger heartbeat. |
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.
Reviewed 1 of 1 files at r4.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @james-rae)
Relates to #99
Check if there were existing keys in the wms service url and enhance xml parsing performance for WMS layers.
Note: It is for python 2.7.
This change is