From 156a2d4f18ced130f4a700884efc61ee5c60184f Mon Sep 17 00:00:00 2001 From: Dan Bowerman Date: Mon, 11 Jul 2016 15:18:19 -0400 Subject: [PATCH 1/6] fix(registration): fix display field not being stored in layer registration display_field exists within the RCS 2.0.0 schema, but is not being set. This patch resolves this and stores the display_field as nameField within the CouchDB storage. Closes #48 --- services/regparse/universal.py | 2 ++ static/test.html | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/services/regparse/universal.py b/services/regparse/universal.py index 17fc89f..6dac148 100644 --- a/services/regparse/universal.py +++ b/services/regparse/universal.py @@ -124,6 +124,8 @@ def make_node(key, json_request, config): if c_url: node[lang]['metadataUrl'] = m_url node[lang]['catalogueUrl'] = c_url + if 'display_field' in json_request[lang]: + n['nameField'] = json_request[lang]['display_field'] n.update(parser_map[ltype](json_request[lang])) if 'service_name' in json_request[lang]: # important to do this last so it overwrites anything scraped from the custom parser diff --git a/static/test.html b/static/test.html index 66dcb3a..a9d197f 100644 --- a/static/test.html +++ b/static/test.html @@ -104,6 +104,7 @@ +
@@ -281,6 +282,21 @@ "service_name": "WMS english" }, "version": "2.0" + }, + sampleDisplayField = { + "fr": { + "service_url": "http://section917.cloudapp.net/arcgis/rest/services/JOSM/Oilsands_fr/MapServer/20", + "service_type": "esriFeature", + "display_field": "siteShortName_fr", + "service_name": "Surveillance de la situation et des tendances d'oiseaux terrestres inscrits rares et difficiles à surveiller" + }, + "en": { + "service_url": "http://section917.cloudapp.net/arcgis/rest/services/JOSM/Oilsands_en/MapServer/20", + "service_type": "esriFeature", + "display_field": "siteShortName_en", + "service_name": "Status and Trend Monitoring of Listed, Rare, and Difficult-to-Monitor Landbirds" + }, + "version": "2.0" }; function get_versioned_url() { From 5902b7d9a120f74c8c6792077afd1739ef414ddb Mon Sep 17 00:00:00 2001 From: Dan Bowerman Date: Thu, 14 Jul 2016 11:24:46 -0400 Subject: [PATCH 2/6] feat(retrieval): extend recursive support for map service layers previously recursive only worked with group layers and WMS, this addition adds support for scraping map service layers, and ignoring sublayers within groups as RAMP will handle these automatically. Closes #49 --- services/regparse/esri.py | 13 +++++++++---- static/test.html | 16 ++++++++++++++++ 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/services/regparse/esri.py b/services/regparse/esri.py index 0db2a53..b6424bd 100644 --- a/services/regparse/esri.py +++ b/services/regparse/esri.py @@ -232,10 +232,15 @@ def make_server_node(req): elif 'recursive' in req: query_service = requests.get(req['service_url'] + "?f=pjson", proxies=flask.g.proxies) service_json = query_service.json() - if service_json['type'] == 'Group Layer': - result['service_url'] = req['service_url'].rstrip('1234567890') - result['url'] = req['service_url'].rstrip('1234567890') - sublayer_json = service_json['subLayers'] + result['service_url'] = req['service_url'].rstrip('1234567890') + result['url'] = req['service_url'].rstrip('1234567890') + sublayer_json = [] + if 'type' not in service_json: + for x in service_json['layers']: + if x['parentLayerId'] == -1: + sublayer_json.append(x) + else: + sublayer_json = service_json['subLayers'] result['layerEntries'] = [{'index': sl['id']} for sl in sublayer_json] else: result['layerEntries'] = [] diff --git a/static/test.html b/static/test.html index a9d197f..b6560bb 100644 --- a/static/test.html +++ b/static/test.html @@ -103,6 +103,7 @@ +
@@ -297,6 +298,21 @@ "service_name": "Status and Trend Monitoring of Listed, Rare, and Difficult-to-Monitor Landbirds" }, "version": "2.0" + }, + sampleRecursiveMapservice = { + "en": { + "service_url": "http://geoappext.nrcan.gc.ca/arcgis/rest/services/NorthAmerica/energy_infrastructure_of_north_america_en/MapServer", + "recursive": true, + "service_type": "esriMapServer", + "service_name": "Energy Infrastructure of North America" + }, + "fr": { + "service_url": "http://geoappext.nrcan.gc.ca/arcgis/rest/services/NorthAmerica/energy_infrastructure_of_north_america_fr/MapServer", + "recursive": true, + "service_type": "esriMapServer", + "service_name": "Infrastructure énergétique d'Amérique du Nord" + }, + "version": "2.0" }; function get_versioned_url() { From 47edc5b7f0f9993c68c214907e66e22f8c4932e9 Mon Sep 17 00:00:00 2001 From: Dan Bowerman Date: Thu, 14 Jul 2016 15:22:14 -0400 Subject: [PATCH 3/6] feat(retrieval): extend recursive support for map service layers previously recursive only worked with group layers and WMS, this addition adds support for scraping map service layers, and ignoring sublayers within groups as RAMP will handle these automatically. Updates version to 2.0.2. Closes #49 --- docs/service/contract.rst | 2 ++ setup.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/service/contract.rst b/docs/service/contract.rst index d4f192c..1f26f04 100644 --- a/docs/service/contract.rst +++ b/docs/service/contract.rst @@ -135,6 +135,8 @@ The feature payload should conform to: may be omitted in which case no value will be provided in the output leaving the viewer to apply its own logic.), "tolerance": (int: Tolerance, in pixels, of feature queries), + "recursive": (bool: Indicates if children should be scraped and made available + as individual layers to the viewer), "metadata": { "uuid": (str: a unique identifier), "catalogue_url": (str: URL describing the layer in full detail) diff --git a/setup.py b/setup.py index e37575d..293ec6a 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ setup( name="rcs", description="RAMP Configuration Service", - version="2.0.1", + version="2.0.2", author="Environment and Climate Change Canada", author_email="mike.weech@canada.ca", url="https://github.com/fgpv-vpgf/rcs", From 3f65948bcc837c3fd8f9fdafc80df4fa55072bba Mon Sep 17 00:00:00 2001 From: Dan Bowerman Date: Fri, 15 Jul 2016 09:01:28 -0400 Subject: [PATCH 4/6] feat(retrieval): extend recursive support for map service layers previously recursive only worked with group layers and WMS, this addition adds support for scraping map service layers, and ignoring sublayers within groups as RAMP will handle these automatically. Updates version to 2.0.2. Closes #49 --- docs/service/contract.rst | 2 -- services/regparse/esri.py | 4 +--- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/docs/service/contract.rst b/docs/service/contract.rst index 1f26f04..d4f192c 100644 --- a/docs/service/contract.rst +++ b/docs/service/contract.rst @@ -135,8 +135,6 @@ The feature payload should conform to: may be omitted in which case no value will be provided in the output leaving the viewer to apply its own logic.), "tolerance": (int: Tolerance, in pixels, of feature queries), - "recursive": (bool: Indicates if children should be scraped and made available - as individual layers to the viewer), "metadata": { "uuid": (str: a unique identifier), "catalogue_url": (str: URL describing the layer in full detail) diff --git a/services/regparse/esri.py b/services/regparse/esri.py index b6424bd..49564e7 100644 --- a/services/regparse/esri.py +++ b/services/regparse/esri.py @@ -236,9 +236,7 @@ def make_server_node(req): result['url'] = req['service_url'].rstrip('1234567890') sublayer_json = [] if 'type' not in service_json: - for x in service_json['layers']: - if x['parentLayerId'] == -1: - sublayer_json.append(x) + sublayer_json = [x for x in service_json['layers'] if x['parentLayerId'] == -1] else: sublayer_json = service_json['subLayers'] result['layerEntries'] = [{'index': sl['id']} for sl in sublayer_json] From 3c002e6b08008b6526f0d7170467eeda4fd8dca9 Mon Sep 17 00:00:00 2001 From: Dan Bowerman Date: Fri, 15 Jul 2016 09:44:50 -0400 Subject: [PATCH 5/6] fix(version): correct version to 2.1.0 mistakenly added endpoint functionality under a patch version # instead of a minor version Closes #49 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 293ec6a..2bd158e 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ setup( name="rcs", description="RAMP Configuration Service", - version="2.0.2", + version="2.1.0", author="Environment and Climate Change Canada", author_email="mike.weech@canada.ca", url="https://github.com/fgpv-vpgf/rcs", From 39ea3d536e79545c16a528175c639a6abe7b575b Mon Sep 17 00:00:00 2001 From: Dan Bowerman Date: Fri, 15 Jul 2016 09:47:57 -0400 Subject: [PATCH 6/6] fix(version): correct version to 2.1.0 mistakenly added endpoint functionality under a patch version # instead of a minor version Closes #49 --- docs/conf.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 24aaa7e..4d71765 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -58,9 +58,9 @@ # built documents. # # The short X.Y version. -version = '2.0' +version = '2.1' # The full version, including alpha/beta/rc tags. -release = '2.0.0' +release = '2.1.0' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages.