Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/gm3/actions/mapSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,21 @@
return wfsConf;
}

/** Convert a type='qgis-wfs' layer into type='wfs'
* style layer.
*
* @param mxXml The MapSource XML
* @param conf Application configuration object.
*
* @returns Object defining the WFS service.
*/
function QGISToWFS(msXml, conf) {
return {
type: 'wfs',

Check failure on line 241 in src/gm3/actions/mapSource.js

View workflow job for this annotation

GitHub Actions / tests (ubuntu-24.04, 22.x)

Replace `'wfs'` with `"wfs"`
wgs84Hack: true

Check failure on line 242 in src/gm3/actions/mapSource.js

View workflow job for this annotation

GitHub Actions / tests (ubuntu-24.04, 22.x)

Insert `,`
};
}

/** Add a map-source from XML
*
*/
Expand Down Expand Up @@ -275,6 +290,8 @@
Object.assign(mapSource, mapServerToWMS(xml, config));
} else if (mapSource.type === "mapserver-wfs") {
Object.assign(mapSource, mapServerToWFS(xml, config));
} else if (mapSource.type === "qgis-wfs") {
Object.assign(mapSource, QGISToWFS(xml, config));
}

// parse the optional float attributes
Expand Down
8 changes: 5 additions & 3 deletions src/gm3/components/map/layers/wfs.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export function buildWfsQuery(
// the internal storage mechanism requires features
// returned from the query be stored in 4326 and then
// reprojected on render.
let queryProjection = mapProjection;
let queryProjection = new proj.get(mapProjection);
if (mapSource.wgs84Hack) {
queryProjection = new proj.get("EPSG:4326");
}
Expand Down Expand Up @@ -142,8 +142,10 @@ export function buildWfsQuery(
// the OL formatter requires that the typename and the schema be
// broken apart in order to properly format the request.
const typename = getTypeName(mapSource);

const typeParts = typename.split(":");
let typeParts = typename.split(":");
if (typeParts.length === 1) {
typeParts = ["", typeParts[0]];
}
const formatOptions = {
srsName: queryProjection.getCode(),
featurePrefix: typeParts[0],
Expand Down
Loading