p5WFS_GetFeature() function

Smart js function to get data using WFS API and parse a response.

Usage

p5WFS_GetFeature(table, data)

LABEL DESCRIPTION EXAMPLE
table string containing tablename from db with WFS API namespace 'p5_default_db:CRM_PROCES'
data plainObject containing some of fields:
  • Filter: ocg:Filter
  • sortBy: ordering
  • maxFeatures or count: limit number of features
  • primaryKey: get only one feature with given primaryKey
  • featureID: get only one feature with given featureID
  • xlink: get only one feature by given xlink url ('#' must be replaced with '/')
  • resolve: resolve=all
  • resolveDepth: resolveDepth=3
  • WFS_URL: WFS_URL=https://... to ovrride default wfs url
  • resolveDepth: resolveDepth=3
  • backRefNS: parent object namespace
  • backRefPK: parent object primary key
  • backRefField: field name in parent object (typeName)
  • startIndex: offset
{
            'Filter': '<ogc:PropertyIsEqualTo>
            <ogc:PropertyName>PARENT_ID</ogc:PropertyName>
            <ogc:Literal>7</ogc:Literal>
            </ogc:PropertyIsEqualTo>',
            'sortBy': 'SORT_PRIO+A,ID',
}
return

Promise which resolves to an array of plainObject.

If field values are strings, then it represents xlink. You can fetch this object by using featureID or primaryKey args in p5WFS_GetFeature

[
  {
    "default_db__x3A__CRM_PROCES:PROCES": [
      "https://biuro.biall-net.pl/wfs/default_db/CRM_PROCES#PROCES.123",
      "https://biuro.biall-net.pl/wfs/default_db/CRM_PROCES#PROCES.456"
    ],
    "TYPE": "PROCES",
    "PARENT_ID": "1",
    "DESC": "Opis procesu...",
    "ID": "100"
  }
]

For more information and usage of this parameters look into our wfs api documentation.

Simple example:

        p5WFS_GetFeature('p5_default_db:CRM_PROCES', {
            Filter: '<ogc:PropertyIsEqualTo><ogc:PropertyName>PARENT_ID</ogc:PropertyName><ogc:Literal>7</ogc:Literal></ogc:PropertyIsEqualTo>',
            sortBy: 'SORT_PRIO+A,ID',
            maxFeatures: 100
        }).then(function(features) {
            console.log(features) // features is an array of objects
        }).catch(function(e) {
            console.log('Error', e)
        })

Nested objects example:

        p5WFS_GetFeature('p5_default_db__x3A__CRM_PROCES:PROCES', {
            primaryKey: 100,
            resolve: 'all',
            resolveDepth: 3,
        }).then(function(features) {
            console.log(features) // features is an array of objects
        }).catch(function(e) {
            console.log('Error', e)
        })

Back ref example (get PROCES under PROCES_INIT.123):

        p5WFS_GetFeature('p5_default_db__x3A__CRM_PROCES:PROCES', {
            primaryKey: 100,
            resolve: 'all',
            resolveDepth: 3,
            backRefNS: 'p5_default_db__x3A__CRM_PROCES:PROCES_INIT',
            backRefPK: 123,
            backRefField: 'p5_default_db__x3A__CRM_PROCES:PROCES'
        }).then(function(features) {
            console.log(features) // features is an array of objects
        }).catch(function(e) {
            console.log('Error', e)
        })

Back ref by xlink next data example (get PROCES under PROCES_INIT.123 with offset 10 - skip first 10 features):

?SERVICE=WFS
        &VERSION=1.0.0
        &TYPENAME=p5_default_db__x3A__CRM_PROCES:PROCES
        &REQUEST=GetFeature
        &backRefNS=p5_default_db__x3A__CRM_PROCES:PROCES_INIT
        &backRefPK=123
        &backRefField=p5_default_db__x3A__CRM_PROCES:PROCES
        &startIndex=10
        p5WFS_GetFeature('p5_default_db__x3A__CRM_PROCES:PROCES', {
            primaryKey: 100,
            resolve: 'all',
            resolveDepth: 3,
            backRefNS: 'p5_default_db__x3A__CRM_PROCES:PROCES_INIT',
            backRefPK: 123,
            backRefField: 'p5_default_db__x3A__CRM_PROCES:PROCES',
            startIndex: 10
        }).then(function(features) {
            console.log(features) // features is an array of objects
        }).catch(function(e) {
            console.log('Error', e)
        })