Skip to content

Commit

Permalink
Fix #10470 when CRS is only 1 (#10471)
Browse files Browse the repository at this point in the history
  • Loading branch information
offtherailz authored Jul 15, 2024
1 parent ae4f512 commit 05de4ba
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 1 deletion.
2 changes: 1 addition & 1 deletion web/client/api/WMS.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export const searchAndPaginate = (json = {}, startPosition, maxRecords, text) =>
const root = json.Capability;
const service = json.Service;
const onlineResource = getOnlineResource(root);
const SRSList = root.Layer && (root.Layer.SRS || root.Layer.CRS)?.map((crs) => crs.toUpperCase()) || [];
const SRSList = root.Layer && castArray(root.Layer.SRS || root.Layer.CRS)?.map((crs) => crs.toUpperCase()) || [];
const credits = root.Layer && root.Layer.Attribution && extractCredits(root.Layer.Attribution);
const getMapFormats = castArray(root?.Request?.GetMap?.Format || []);
const getFeatureInfoFormats = castArray(root?.Request?.GetFeatureInfo?.Format || []);
Expand Down
17 changes: 17 additions & 0 deletions web/client/api/__tests__/WMS-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,23 @@ describe('Test correctness of the WMS APIs', () => {
expect(result.service).toBeTruthy();
expect(result.records[0].getMapFormats.length).toBe(20);
expect(result.numberOfRecordsMatched).toBe(5);
expect(result.records[0].SRS.length).toBe(3);
expect(result.layerOptions).toBeTruthy();
expect(result.layerOptions.version).toBe('1.3.0');
done();
} catch (ex) {
done(ex);
}
});
});
it('GetRecords', (done) => {
API.getRecords('base/web/client/test-resources/wms/GetCapabilities-1.3.0-minimal.xml', 0, 2, '').then((result) => {
try {
expect(result).toBeTruthy();
expect(result.service).toBeTruthy();
expect(result.records[0].getMapFormats.length).toBe(1);
expect(result.records[0].SRS.length).toBe(1);
expect(result.numberOfRecordsMatched).toBe(1);
expect(result.layerOptions).toBeTruthy();
expect(result.layerOptions.version).toBe('1.3.0');
done();
Expand Down
55 changes: 55 additions & 0 deletions web/client/test-resources/wms/GetCapabilities-1.3.0-minimal.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<WMS_Capabilities xmlns="http://www.opengis.net/wms"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wms http://schemas.opengis.net/wms/1.3.0/capabilities_1_3_0.xsd" version="1.3.0">
<Service>
<Name>WMS</Name>
<Title>Map</Title>
<OnlineResource xlink:type="simple" xlink:href="http://10.0.0.191:80/wms" />
<MaxWidth>4096</MaxWidth>
<MaxHeight>4096</MaxHeight>
</Service>
<Capability>
<Request>
<GetCapabilities>
<Format>text/xml</Format>
<DCPType>
<HTTP>
<Get>
<OnlineResource xlink:type="simple" xlink:href="http://10.0.0.191:80/wms?" />
</Get>
</HTTP>
</DCPType>
</GetCapabilities>
<GetFeatureInfo>
<Format>application/json</Format>
<DCPType>
<HTTP>
<Get>
<OnlineResource xlink:type="simple" xlink:href="http://10.0.0.191:80/wms?" />
</Get>
</HTTP>
</DCPType>
</GetFeatureInfo>
<GetMap>
<Format>image/png</Format>
<DCPType>
<HTTP>
<Get>
<OnlineResource xlink:type="simple" xlink:href="http://10.0.0.191:80/wms?" />
</Get>
</HTTP>
</DCPType>
</GetMap>
</Request>
<Exception>
<Format>XML</Format>
</Exception>
<Layer queryable="1">
<Name>Map</Name>
<Title>Map</Title>
<CRS>EPSG:3857</CRS>
<BoundingBox CRS="EPSG:3857" minx="-8547715.63930251" miny="5199853.840378792" maxx="-8477042.31270172" maxy="5255826.651484046" />
</Layer>
</Capability>
</WMS_Capabilities>

0 comments on commit 05de4ba

Please sign in to comment.