Package Exports
- query-fis-broker-wfs
- query-fis-broker-wfs/get-features
- query-fis-broker-wfs/get-features.js
- query-fis-broker-wfs/index.js
- query-fis-broker-wfs/lib/helpers
- query-fis-broker-wfs/lib/helpers.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (query-fis-broker-wfs) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
query-fis-broker-wfs
Query WFS sources in the Berlin geodata portal FIS-Broker.
Installing
npm install query-fis-broker-wfsUsage
import {getFeatures} from 'query-fis-broker-wfs/get-features.js'
const endpoint = 'https://fbinter.stadt-berlin.de/fb/wfs/data/senstadt/s_plz'
const layer = 'fis:s_plz'
// senstadt/s_plz uses the ETRS89 (EPSG:25833) coordinate reference system (CRS).
// see also https://epsg.io/25833 & http://www.opengis.net/def/crs/EPSG/0/25833
const bbox = [387000, 5812000, 386000, 5813000]
const features = getFeatures(endpoint, layer, {bbox}
for await (const feature of features) {
console.log(feature)
}Note: You can obtain the WFS layer's native coordinate reference system (CRS) from the layers[…].crs field of a getCapabilities() response.
The call above will return data in the xml-reader shape:
{
name: 'fis:s_plz',
type: 'element',
value: '',
parent: {
name: 'wfs:member',
type: 'element',
value: '',
parent: { /* … */ },
attributes: {},
children: [ /* … */ ]
},
attributes: {
'gml:id': 's_plz.12165'
},
children: [{
name: 'fis:plz',
type: 'element',
value: '',
parent: [ /* … */ ],
attributes: {},
children: [{
name: '',
type: 'text',
value: '12165',
parent: [ /* … */ ],
attributes: {},
children: [],
}]
}, {
name: 'fis:finhalt',
type: 'element',
value: '',
parent: [ /* … */ ],
attributes: {},
children: [{
name: '',
type: 'text',
value: '945018.6987053645',
parent: [ /* … */ ],
attributes: {},
children: [],
}]
}, {
name: 'fis:geom',
type: 'element',
value: '',
parent: [ /* … */ ],
attributes: {},
children: [{
name: 'gml:Polygon',
type: 'element',
value: '',
parent: [ /* … */ ],
attributes: { 'gml:id': 'P1' },
children: [ /* … */ ],
}]
}]
}You can use parse-gml-polygon to convert the gml:* elements (gml:Polygon etc.) within fis:geom to GeoJSON; example.js demonstrates how to do this.
API
getCapabilities(endpoint) -> Promise
Uses the GetCapabilities method, returns data that looks like this:
{
operations: [ {
name: 'GetCapabilities',
params: [ {
name: 'AcceptVersions',
defaultValue: '2.0.0',
allowedValues: ['1.0.0', '1.1.0', '2.0.0']
}, {
name: 'AcceptFormats',
defaultValue: 'text/xml',
allowedValues: ['text/xml']
} ]
}, {
name: 'GetFeature',
params: [ {
name: 'resultType',
defaultValue: null,
allowedValues: ['results', 'hits']
}, {
name: 'outputFormat',
defaultValue: 'application/gml+xml; version=3.2',
allowedValues: [
'text/xml; subtype=gml/2.1.2',
'text/xml; subtype=gml/3.1.1',
'text/xml; subtype=gml/3.2.1'
// …
]
} ]
} ],
defaultVersion: '2.0.0',
allowedVersions: ['1.0.0', '1.1.0', '2.0.0'],
featureTypes: [ {
name: 'fis:s_plz',
title: 'Postleitzahlen',
description: 'PLZ - Postleitzahlgebiete Berlins',
crs: 'urn:ogc:def:crs:EPSG:6.9:25833',
outputFormats: [
'text/xml; subtype=gml/2.1.2',
'text/xml; subtype=gml/3.1.1',
'text/xml; subtype=gml/3.2.1'
// …
],
bbox: {
minLat: 52.3284,
minLon: 13.079,
maxLat: 52.6877,
maxLon: 13.7701
}
} ],
spatialCapabilities: [
'BBOX',
'Equals',
'Disjoint'
// …
]
}getFeatures(endpoint, layer, [opt]) -> Readable stream
Uses the GetFeature method.
You may optionally pass the options bbox, crs, results, sortBy, props.
Related
- transform-coordinates – Transform coordinates from one coordinate system to another.
- parse-gml-polygon – Convert a GML
Polygoninto a GeoJSON geometry.
Contributing
If you have a question or have difficulties using query-fis-broker-wfs, please double-check your code and setup first. If you think you have found a bug or want to propose a feature, refer to the issues page.