Skip to content

Commit

Permalink
Simplify the logic: we don't need to tell whether the url is for one …
Browse files Browse the repository at this point in the history
…feature group or not specify
  • Loading branch information
t83714 committed Jul 4, 2021
1 parent 7eafcb9 commit 4915cc9
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/format-engine/measures/downloadExtensionMeasure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ const URL_REGEXES: Array<[RegExp, string]> = [
[new RegExp(".*\\?.*service=wms.*", "i"), "WMS"],
[new RegExp(".*\\?.*service=wfs.*", "i"), "WFS"],
[new RegExp("\\W+MapServer\\W*", "i"), "ESRI MAPSERVER"],
// ESRI FeatureServer Group We will set as "ESRI MAPSERVER" for now: https://github.com/magda-io/magda-minion-format/issues/8
// ESRI FeatureServer We will set as "ESRI MAPSERVER" for now: https://github.com/magda-io/magda-minion-format/issues/8
[
new RegExp("(\\W+FeatureServer)|(\\W+FeatureServer/)$", "i"),
new RegExp("(\\W+FeatureServer$)|(\\W+FeatureServer/)", "i"),
"ESRI MAPSERVER"
],
[new RegExp("\\W+FeatureServer/d", "i"), "ESRI MAPSERVER"], // ESRI FeatureServer
[
new RegExp("(\\W+SceneServer)|(\\W+SceneServer/)$", "i"),
new RegExp("(\\W+SceneServer$)|(\\W+SceneServer/)", "i"),
"ESRI SCENESERVER"
], // ESRI SceneServer
[new RegExp(".*\\.(shp|shz|dbf)(\\.zip)?$", "i"), "SHP"],
Expand Down
5 changes: 5 additions & 0 deletions src/test/onRecordFound.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,11 @@ describe("onRecordFound", async function(this) {
"ESRI SCENESERVER"
);

testDistFileReturnsFormat(
"./sampleDataFiles/esri-sceneserver2.json",
"ESRI SCENESERVER"
);

// we put as ESRI MAPSERVER for now see https://github.com/magda-io/magda-minion-format/issues/8
testDistFileReturnsFormat(
"./sampleDataFiles/esri-featureserver-group1.json",
Expand Down
50 changes: 50 additions & 0 deletions src/test/sampleDataFiles/esri-sceneserver2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"aspects": {
"source": {
"id": "nsw-ckan",
"name": "data.nsw.gov.au",
"type": "ckan-resource",
"url": "https://data.nsw.gov.au/data/api/3/action/resource_show?id=b8ce96a0-ccd9-41b1-ab57-91585d4ea9c9"
},
"ckan-resource": {
"cache_last_updated": null,
"cache_url": null,
"created": "2021-04-29T11:13:30",
"datastore_active": false,
"datastore_contains_all_records_of_source_file": false,
"format": "ARCGIS REST SERVICE",
"hash": "",
"id": "b8ce96a0-ccd9-41b1-ab57-91585d4ea9c9",
"last_modified": null,
"metadata_modified": "2021-06-30T14:22:59.061057",
"mimetype": null,
"mimetype_inner": null,
"package_id": "b63902fd-ed0a-432e-b928-3e70eaac5daa",
"position": 0,
"resource_type": null,
"size": null,
"state": "active",
"url": "https://portal.spatial.nsw.gov.au/portal/sharing/servers/245813070a2e433ea385b709507643b6/rest/services/Hosted/CAMDEN_3D_STRATA_20210310/SceneServer/99",
"url_type": null
},
"dcat-distribution-strings": {
"downloadURL": "https://portal.spatial.nsw.gov.au/portal/sharing/servers/245813070a2e433ea385b709507643b6/rest/services/Hosted/CAMDEN_3D_STRATA_20210310/SceneServer/99",
"format": "ARCGIS REST SERVICE",
"issued": "2021-04-29T11:13:30Z",
"license": "Creative Commons Attribution",
"title": "b8ce96a0-ccd9-41b1-ab57-91585d4ea9c9"
},
"source-link-status": {
"httpStatusCode": 200,
"status": "active"
},
"dataset-format": {
"confidenceLevel": 33,
"format": "ARCGIS"
}
},
"id": "dist-nsw-ckan-b8ce96a0-ccd9-41b1-ab57-91585d4ea9c9",
"name": "b8ce96a0-ccd9-41b1-ab57-91585d4ea9c9",
"sourceTag": "eb74ae9c-a301-441b-857b-54d5db622d90",
"tenantId": 0
}

0 comments on commit 4915cc9

Please sign in to comment.