Skip to content

Commit

Permalink
Merge branch 'main' into fix-wms-nested-ids
Browse files Browse the repository at this point in the history
  • Loading branch information
nf-s authored Nov 3, 2023
2 parents c2d5cf1 + 2567156 commit bb81ca7
Show file tree
Hide file tree
Showing 14 changed files with 1,391 additions and 585 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/find-region-mapping-alias-duplicates.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Find region mapping alias duplicates

# Run when regionMapping.json file or is updated
on:
push:
paths:
- "wwwroot/data/regionMapping.json"
- "buildprocess/find-region-mapping-alias-duplicates.js"
pull_request:
paths:
- "wwwroot/data/regionMapping.json"
- "buildprocess/find-region-mapping-alias-duplicates.js"

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job
find-alias-duplicates:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Check out only 2 files
# Use without cone mode as no git operations are executed past checkout
- uses: actions/checkout@v4
with:
sparse-checkout: |
wwwroot/data/regionMapping.json
buildprocess/find-region-mapping-alias-duplicates.js
sparse-checkout-cone-mode: false

- name: Check aliases
run: |
node buildprocess/find-region-mapping-alias-duplicates.js
9 changes: 8 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@
#### next release (8.3.8)

- Fix WMS nested group IDs - nested groups with the same name were not being created
- Remove `jsx-control-statements` dependency
- WMS `isEsri` default value will now check for case-insensitive `mapserver/wmsserver` (instead of `MapServer/WMSServer`)
- Tweak ArcGis MapServer WMS `GetFeatureInfo` default behaviour
- Add `application/geo+json` and `application/vnd.geo+json` default `GetFeatureInfo` (after `application/json` in priority list)
- Add `application/xml` default `GetFeatureInfo`. (if `isEsri` is true, then this will be used before `text/html`)
- Added many remaining ASGS 2021 region types to region mapping (STE_2021,ILOC_2021,IARE_2021,IREG_2021,RA_2021,SAL_2021,ADD_2021,DZN_2021,LGA_2022,LGA_2023,SED_2021,SED_2022,
CED_2021,POA_2021,TR_2021,SUA_2021,UCL_2021,SOS_2021,SOSR_2021).
- See [ASGS 2021](https://www.abs.gov.au/statistics/standards/australian-statistical-geography-standard-asgs-edition-3/jul2021-jun2026/access-and-downloads/digital-boundary-files)
- Added [Melbourne CLUE blocks](https://data.melbourne.vic.gov.au/pages/clue/) to region mapping.
- [The next improvement]

#### 8.3.7 - 2023-10-26
Expand Down
22 changes: 22 additions & 0 deletions buildprocess/find-region-mapping-alias-duplicates.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const fs = require("fs");
const regions = JSON.parse(
fs.readFileSync("wwwroot/data/regionMapping.json")
).regionWmsMap;

const aliasToType = new Map();
for (const [regType, regDef] of Object.entries(regions)) {
for (const alias of regDef.aliases ?? []) {
aliasToType.set(alias, [...(aliasToType.get(alias) ?? []), regType]);
}
}

let issues = 0;
for (const [alias, regTypes] of aliasToType.entries()) {
if (regTypes.length > 1) {
console.error(
`Alias "${alias}" used in multiple types: ${regTypes.join(", ")}`
);
issues++;
}
}
process.exitCode = issues > 0 ? 1 : 0;
23 changes: 21 additions & 2 deletions lib/Models/Catalog/Ows/WebMapServiceCapabilitiesStratum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,9 @@ export default class WebMapServiceCapabilitiesStratum extends LoadableStratum(
@computed
get isEsri(): boolean {
if (this.catalogItem.url !== undefined)
return this.catalogItem.url.indexOf("MapServer/WMSServer") > -1;
return (
this.catalogItem.url.toLowerCase().indexOf("mapserver/wmsserver") > -1
);
return false;
}

Expand Down Expand Up @@ -831,9 +833,11 @@ export default class WebMapServiceCapabilitiesStratum extends LoadableStratum(
}

/** Prioritize format of GetFeatureInfo:
* - JSON
* - JSON/GeoJSON
* - If ESRI, then we prioritise XML next
* - HTML
* - GML
* - XML
* - Plain text
*
* If no matching format can be found in GetCapabilities, then Cesium will use defaults (see `WebMapServiceImageryProvider.DefaultGetFeatureInfoFormats`)
Expand All @@ -852,10 +856,25 @@ export default class WebMapServiceCapabilitiesStratum extends LoadableStratum(

if (formatsArray.includes("application/json"))
return { format: "application/json", type: "json" };
if (formatsArray.includes("application/geo+json"))
return { format: "application/geo+json", type: "json" };
if (formatsArray.includes("application/vnd.geo+json"))
return { format: "application/vnd.geo+json", type: "json" };

// Special case for Esri WMS, use XML before HTML/GML
// as HTML includes <table> with rowbg that is hard to read
if (this.isEsri && formatsArray.includes("text/xml")) {
return { format: "text/xml", type: "xml" };
}
if (formatsArray.includes("text/html"))
return { format: "text/html", type: "html" };
if (formatsArray.includes("application/vnd.ogc.gml"))
return { format: "application/vnd.ogc.gml", type: "xml" };

// For non-Esri services, we use XML after HTML/GML
if (formatsArray.includes("text/xml")) {
return { format: "text/xml", type: "xml" };
}
if (formatsArray.includes("text/plain"))
return { format: "text/plain", type: "text" };
}
Expand Down
Loading

0 comments on commit bb81ca7

Please sign in to comment.