GeoJSON



WFS JSON OUTPUT

1. Purpose

The purpose of this document is to specified the JSON output of a WFS and how JSON messages can be sent to a WFS.

2. Preliminary

JSON is a string representation of a data structure, in a JavaScript literal form, which makes it easy for browsers to read and transform into real objects, so requiring no extra transformation which have a cost (in terms of development and processing).

The objective is clearly to not loose too much information versus the GML output.

1. Notation

Javascript objects are container of properties which have a name and a value.

The notation is { "name1":Value1, "namei":Valuei, "namex",Valuex}

An array of object is written as [value1,valuei,valuex]

2. Character set

A javascript is a text file without any character set encoding declaration, the default encoding will be utf-8. IF another charset has to be used, it should be specified in a charset parameter of the mime type.

3. Feature Model

The GML Feature defines a real object as an object with named properties. These properties may have a cardinality between 0 and n; the type of the properties ranges from a simple type (like a boolean , a string) to an entire collection of heterogeneous features.

3. Basic Types Encoding

1. Null Value

A null value is encoded with the literal null

2. String

A String is encoded as “value” (e.g “myvalue” )

3. Numeric Values

A Numeric value is encoded as it is (e.g 100)

4. Boolean

A boolean value is encoded with the literal false or true.

5. Date

A date is encoded as a string using an ISO8601 formatting (e.g “2000-10-09”)

6. Measure

A measure is an object holding a value and an unit. It is encoded as an object with the value and unit properties. e.g; {“value”: 100, “unit”:”km”}. The value property is a numeric and the unit property is a string. The unit property is optional.

7. StringCode

A stringcode is an object holding a string value and a code value. It is encoded as an object with the value and code properties e.g. {“value”:”myname”, “code”:”mynamespace”}. The value and the code properties are string. The code property is optional.

8. Geometry

A geometry is encoded as an object having the following properties:

• a crs providing the crs/srs of the geometry as a string. If missing the EPSG:4326 is used.

• a type providing the type of the geometry as a string. The possible values are the WKT tag as POINT,LINESTRING,POLYGON

• a card providing the number of ordinates per point. If missing it default to 2.

• a data providing the array of ordinates.

• an optional env providing the box of the geometry

The data property is encoded as a WKT object using [ ] and , as separator of ordinates and tuples.

The env property is a bounding box encoded in WKT.

Example:

A polygon with one exterior ring.

{"crs":"EPSG:4326","type":"POLYGON","card":2,

                        "env":[5.6904,49.773,5.7622,49.8559],

                        "data":[[5.7061,49.8242,5.706,49.809,5.703,49.7983,5.6904,

                                 49.7825,5.7038,49.7753,5.7091,49.7753,5.7135,49.7749,

                                 5.7193,49.7758,5.726,49.773,5.7279,49.7733,5.7309,

                                 49.7735,5.7326,49.7735,5.7348,49.7747,5.7373,49.7745,

                                 5.7398,49.7764,5.7446,49.7783,5.7466,49.7805,5.7494,

                                 49.7815,5.7541,49.7832,5.7556,49.7871,5.7567,49.789,

                                 5.7589,49.7915,5.7553,49.8137,5.7535,49.8165,5.7513,

                                 49.818,5.751,49.821,5.751,49.8251,5.7501,49.828,

                                 5.7477,49.832,5.7433,49.8355,5.7453,49.8377,5.75,

                                 49.8381,5.7517,49.8389,5.7508,49.8411,5.7519,49.8448,

                                 5.755,49.8449,5.7596,49.8441,5.7622,49.846,5.7593,

                                 49.8494,5.7554,49.8516,5.7505,49.8516,5.75,49.8543,

                                 5.7434,49.8554,5.74,49.8553,5.7365,49.8559,5.7296,

                                 49.8538,5.7244,49.8538,5.7193,49.853,5.7159,49.8437,

                                 5.7128,49.8398,5.7056,49.831,5.7078,49.8258,5.7061,

                                 49.8242]]},

4. Common WFS output

The WFS output for a DescribeFeatureType or a GetFeature will be composed of an object sharing common properties.

The common properties are:

• options to carry some information about the output.

• namespaces to carry the namespaces definitions

• types to carry the types definitions

1. Options

The purpose of the options object is to give information about the current output. The options will be the name of the properties.

Currently two options are available:

• typedesc : defines how  the types are described. The values are concise , chain or flat .

• arrayoutput : if set a feature will be defined  as an ordered array of values, if not net the feature will be defined as an unordered array of values.

Example

"options:{"typedesc":"concise","arrayoutput":false}

2. Namespaces

The namespaces object is an object composed of properties whose name is the prefix and whose value is the xml namespace.

Ex:

    {

        "i0":"",

        "i1":""

    }

The main purpose of this object is to avoid repeating long namespace onto other objects. The resolution of prefix should be lenient, if it cannot be found in the namespaces object, the prefix should be used as the namespace definition. This will allow application to use the more verbose format by associated the full namespace instead of building a prefix.

3. Types

The types object defines the used feature types.

Each property of the object gives a short name (reference) for the feature type and the full definition of the feature type.

The short name is simply the name of the property and value of the property will contain the whole description as an array of definitions. That definition structure depends on the typedesc option.

a) Concise Mode

In this mode, only the name and the namespace of the feature type is provided. The properties used are:

name : to provide the name of the feature type

ns : to provide the feature type namespace as a reference in namespaces object

b) Flat Mode

In this mode, the full definition of the feature type is provided but each type is dumped without hierarchical information. The properties used are:

name : to provide the name of the feature type

ns : to provide the feature type namespace as a reference in namespaces object

defs: to provide the type definition (see below)

c) Chain Mode

In this mode, the full definition of the feature type is provided including hierarchical information and so each type is dumped with its local properties. The properties used are:

name : to provide the name of the feature type

ns : to provide the feature type namespace as a reference in namespaces object

defs: to provide the type definition (see below)

parent : containing a reference in the types object of the parent type if any.

d) Property Definition

The defs property will contain an array of property definition object. Each definition will provide complete information about one feature property. Each definition will contain the following properties:

name : the name of the property

type : the property type

ns : the property namespace as a reference in the namespaces object . If missing the namespace will be the one associated to the enclosing type.

itemtype : the type of  the container item type. This is used when the property type is an array of simple type.

values : the allowed,enumeration values,if any. If the type has no enumeration values, simply omit this property.

Optional : a boolean saying if the property is optional or not

e) Chain Example

{"options":{"typedesc":"chain","arrayoutput":false},

 "namespaces":{"i1":"","i0":""},

 "types":{"t0":{"name":"_Feature","ns":"i0",

                "defs":[{"name":"description","type":"string"},

                        {"name":"name","type":"string"},

                        {"name":"boundedBy","type":"BBOX"}]},

          "t1":{"name":"DISTR","ns":"i1","parent":"t0",

                "defs":[{"name":"Name","type":"string"},

                        {"name":"Geometry","type":"POLYGON"},

                        {"name":"Url","type":"string"}]},

          "t2":{"name":"GEM","ns":"i1","parent":"t0",

                "defs":[{"name":"Name","type":"string"},

                        {"name":"Geometry","type":"POLYGON"},

                        {"name":"Url","type":"string"},

                        {"name":"ID","type":"string"}]}}}

f) Flat example

{“options":{"typedesc":"flat","arrayoutput":false},

 "namespaces":{"i1":"","i0":""},

 "types":{

          "t0":{"name":"DISTR","ns":"i1",

                "defs":[

                        {"name":"description","ns":"i0","type":"string"},

                        {"name":"name","ns":"i0","type":"string"},

                        {"name":"boundedBy","ns":"i0","type":"BBOX"}

                        {"name":"Name","ns":"i1","type":"string"},

                        {"name":"Geometry","ns":"i1","type":"POLYGON"},

                        {"name":"Url","ns":"i1","type":"string"}]}

g) Concise example

{“options":{"typedesc":"flat","arrayoutput":false},

 "namespaces":{"i1":"","i0":""},

 "types":{

          "t0":{"name":"DISTR","ns":"i1"},”t1”:{“name”:”GEMPOP”,”ns”:”i1”}}}

h) Well known type name

The following table gives the well known type name (used in the type or itemtype properties).

|Type Name |Description |ItemType meaning |Values |SimpleType |

|string |A string value |Not allowed |Enumeration values |yes |

|double |A double value |Not allowed |Enumeration values |yes |

|float |A float value |Not allowed |Enumeration values |yes |

|long |A long value |Not allowed |Enumeration values |yes |

|int |A int value |Not allowed |Enumeration values |yes |

|short |A short value |Not allowed |Enumeration values |yes |

|boolean |A boolean value |Not allowed | |yes |

|date |A date value |Not allowed | |yes |

|datetime |A date and time value |Not allowed | |yes |

|measure |A measure value |Not allowed | |yes |

|Stringcode |A stringcode value |Not allowed | |yes |

|WKT tag name |The corresponding geometry type |Not allowed | |yes |

|array |An array of simple type |The simple type of an | |no |

| | |array item | | |

|feature |A feature object | | |no |

|collection |A collection of feature object | | |no |

The array, feature and collection type allowed to define deeply structure but can be avoided in order to use simple flat structure.

4. Types Ouput

The result of a DescribeFeatureType will be an object containing the options, namespaces and types properties as descibed.

5. Features

The result of a GetFeature will be an object containing the options, namespaces and types properties as descibed and a features property containg an array of feature values.

a) Feature Value

Each feature is composed of:

• an id property providing the feature identifier as a string

• an type property providing the feature type short name (i.e. a reference in the Types object)

• a props property providing the properties of the feature as an an ordered array of value or a possibly unordered array of feature property object. The choice is defined by the arrayoutput option.

b) Feature Property

Each property is composed of

a name providing the property name

a ns providing the property namespace (i.e. a reference in the namespaces object)

a value providing the property value

It is understood than in both cases the value can be null, a simple type (like string) or something more complex like a geometry, an array, a feature or a collection.

The choice is more dictate by the application in the first case all properties must be provided ordered but the result is more compact, in the second case the result is more verbose but the some properties may be missing and ordering is not requested.

c) Ordered Example

{"options":{"typedesc":"chain","arrayoutput":true},

 "namespaces":{"i1":"","i0":""},

 "types":{"t0":{"name":"_Feature","ns":"i0",

                "defs":[{"name":"description","type":"string"},

                        {"name":"name","type":"string"},

                        {"name":"boundedBy","type":"BBOX"}]},

          "t1":{"name":"GEMPOP","ns":"i1","parent":"t0",

                "defs":[{"name":"Name","type":"string"},

                        {"name":"Geometry","type":"POLYGON"},

                        {"name":"Url","type":"string"},

                        {"name":"Commune","type":"string"},

                        {"name":"Commune_ND","type":"string"},

                        {"name":"Male","type":"integer"},

                        {"name":"Female","type":"integer"},

                        {"name":"Region","type":"string"},

                        {"name":"Province","type":"string"},

                        {"name":"Arrondissement","type":"string"}]}},

 "features":[{"id":"GEMPOP.4D617274656C616E6765","type":"t1",

              "props":[null,null,null,"Martelange",

                       {"crs":"EPSG:4326","type":"POLYGON","card":2,

                        "env":[5.6904,49.773,5.7622,49.8559],

                        "data":[[5.7061,49.8242,5.706,49.809,5.703,49.7983,5.6904,

                                 49.7825,5.7038,49.7753,5.7091,49.7753,5.7135,49.7749,

                                 5.7193,49.7758,5.726,49.773,5.7279,49.7733,5.7309,

                                 49.7735,5.7326,49.7735,5.7348,49.7747,5.7373,49.7745,

                                 5.7398,49.7764,5.7446,49.7783,5.7466,49.7805,5.7494,

                                 49.7815,5.7541,49.7832,5.7556,49.7871,5.7567,49.789,

                                 5.7589,49.7915,5.7553,49.8137,5.7535,49.8165,5.7513,

                                 49.818,5.751,49.821,5.751,49.8251,5.7501,49.828,

                                 5.7477,49.832,5.7433,49.8355,5.7453,49.8377,5.75,

                                 49.8381,5.7517,49.8389,5.7508,49.8411,5.7519,49.8448,

                                 5.755,49.8449,5.7596,49.8441,5.7622,49.846,5.7593,

                                 49.8494,5.7554,49.8516,5.7505,49.8516,5.75,49.8543,

                                 5.7434,49.8554,5.74,49.8553,5.7365,49.8559,5.7296,

                                 49.8538,5.7244,49.8538,5.7193,49.853,5.7159,49.8437,

                                 5.7128,49.8398,5.7056,49.831,5.7078,49.8258,5.7061,

                                 49.8242]]},

                       null,"Martelange","Martelange",701,727,"WALLONIE","Luxembourg",

                       null]},

             {"id":"GEMPOP.4D657373616E6379","type":"t1",

              "props":[null,null,null,"Messancy",

                       {"crs":"EPSG:4326","type":"POLYGON","card":2,

                        "env":[5.7344,49.5698,5.8849,49.6593],

                        "data":[[5.8849,49.6246,5.8791,49.6272,5.8735,49.6284,5.8716,

                                 49.6305,5.8726,49.6321,5.8732,49.6333,5.8718,49.6359,

                                 5.8698,49.64,5.8605,49.6393,5.8571,49.6412,5.8544,

                                 49.6412,5.8512,49.6434,5.8492,49.643,5.8474,49.6448,

                                 5.8447,49.6423,5.8421,49.6434,5.8367,49.6441,5.833,

                                 49.6463,5.8305,49.6449,5.8289,49.6438,5.8267,49.6421,

                                 5.8252,49.6415,5.8227,49.6393,5.8183,49.64,5.8197,

                                 49.6418,5.8222,49.6429,5.8231,49.6473,5.8156,49.6593,

                                 5.8102,49.6564,5.8042,49.647,5.7957,49.6557,5.7928,

                                 49.6557,5.7906,49.6416,5.7864,49.6406,5.7902,49.6358,

                                 5.7912,49.6332,5.789,49.6325,5.7847,49.6325,5.7825,

                                 49.6298,5.7813,49.6255,5.7804,49.623,5.7759,49.6224,

                                 5.7706,49.6237,5.7643,49.6246,5.7608,49.6238,5.7568,

                                 49.6223,5.7526,49.6219,5.7512,49.6237,5.7442,49.6239,

                                 5.7394,49.62,5.7408,49.6182,5.7386,49.6162,5.7344,

                                 49.6102,5.741,49.6086,5.7461,49.6063,5.748,49.603,

                                 5.7466,49.5999,5.744,49.5991,5.744,49.598,5.7441,

                                 49.5954,5.7458,49.5954,5.749,49.598,5.75,49.5977,

                                 5.7501,49.596,5.7501,49.5943,5.752,49.5944,5.7561,

                                 49.5963,5.7692,49.5941,5.7703,49.5944,5.7716,49.5917,

                                 5.7747,49.5919,5.7774,49.59,5.7825,49.5917,5.7929,

                                 49.588,5.7951,49.5881,5.7967,49.5862,5.8016,49.5859,

                                 5.8325,49.5723,5.8344,49.5734,5.8389,49.5698,5.8488,

                                 49.5706,5.8549,49.5725,5.8524,49.579,5.8536,49.5876,

                                 5.8537,49.5941,5.8586,49.5976,5.872,49.6024,5.8787,

                                 49.6057,5.8787,49.6098,5.8774,49.6154,5.8811,49.6204,

                                 5.8849,49.6246]]},

                       null,"Messancy","Messancy",3386,3516,"WALLONIE","Luxembourg",

                       null]}]

    }

d) Unordered Example

{

“options”:{”typedesc”:”concise”,”arrayoutput”:false},

"namespaces":{"i0":"",

                         "i1":""

                        },

"types":{"t0":{"name":"GEMPOP",

                        "ns":"i0"}

            },

"features":[{"id":"GEMPOP.426C616E6B656E6265726765",

                     "type":"t0",

                     "props":[{"name":"description","ns":"i1","value":null},

                                    {"name":"name","ns":"i1","value":null},

                                    {"name":"boundedBy","ns":"i1","value":null},

                                    {"name":"Name","ns":"i0","value":"Blankenberge"},

                                    {"name":"Geometry","ns":"i0",

                                      "value":{ "crs":"EPSG:4326",

                                                     "type":"POLYGON",

                                                     "card":2,

                                                     "env":[3.1183,51.2777,3.1928,51.3281],

                                                     "data":[[3.1183,51.2937,3.1189,51.2914,3.1203,51.2903,3.1208,

                                                                  51.2884,3.1257,51.2873,3.1258,51.2854,

                                                                  3.1259,51.2838,3.1271,51.2827,3.1276,51.2806,

                                                                  3.1291,51.2795,3.1322,51.2777,3.1397,51.2793,3.1468,

                                                                  51.2802,3.1491,51.283,3.1518,51.2837,3.1667,

                                                                  51.2846,3.1688,51.2828,3.1718,51.2831,3.1733,

                                                                  51.288,3.1753,51.2893,3.175,51.2927,3.1831,51.293,3.1834,51.2994,3.187,

                                                                  51.3004,3.1901,51.3017,3.1894,51.3108,3.1884,51.316,3.1928,

                                                                  51.3214,3.1868,51.3244,3.1751,51.3224,3.1726,51.3281,3.1485,

                                                                  51.322,3.1257,51.3159,3.129,51.3112,3.1295,51.307,3.1283,

                                                                  51.303,3.1248,51.3014,3.1225,51.2988,3.1206,51.2953,3.1183,51.2937]]

                                                    }

                                    },

                                 {"name":"Url","ns":"i0","value":null},

                                {"name":"Commune","ns":"i0","value":"Blankenberge"},

                                {"name":"Commune_ND","ns":"i0","value":"Blankenberge"},

                                {"name":"Male", "ns":"i0","value":8291},

                                {"name":"Female","ns":"i0","value":9123},

                                {"name":"Region","ns":"i0","value":"VLAANDEREN"},

                                {"name":"Province","ns":"i0","value":"West-Vlaanderen"},

                                {"name":"Arrondissement","ns":"i0","value":null}

                                ]},

                  {"id":"GEMPOP.427275676765",

                    "type":"t0",

                    "props":[{"name":"description","ns":"i1","value":null},

                                  {"name":"name","ns":"i1","value":null},

                                  {"name":"boundedBy","ns":"i1","value":null},

                                 {"name":"Name","ns":"i0","value":"Brugge"},

                                {"name":"Geometry","ns":"i0",

                                "value":{ "crs":"EPSG:4326","type":"POLYGON","card":2,

                                                "env":[3.1484,51.1605,3.3237,51.3672],

                                                "data":[[3.1726,51.3281,3.1751,51.3224,3.1868,51.3244,3.1928,

                                             51.3214,3.1884,51.316,3.1894,51.3108,3.1901,51.3017,3.187,

                                             51.3004,3.1834,51.2994,3.1831,51.293,3.1906,51.2866,3.1927,51.283,

                                             3.1958,51.2727,3.2006,51.2731,3.202,51.2742,3.2078,51.2762,3.2098,

                                             51.2731,3.2011,51.2645,3.207,51.2509,3.2025,51.2508,3.1963,51.2478,

                                         3.1913,51.2439,3.1829,51.2421,3.1748,51.2402,3.1766,51.235,3.1842,51.2339,

                                             3.1868,51.2295,3.1854,51.2243,3.1781,51.2258,3.1765,51.2252,3.1757,

                                             51.2231,3.1589,51.2201,3.1586,51.2184,3.1578,51.2163,3.1777,51.1871,

                                             3.17,51.187,3.1616,51.1858,3.1555,51.1819,3.1501,51.1799,3.151,51.1752,

                                             3.1484,51.1638,3.1539,51.1622,3.1623,51.1609,3.1706,51.1606,3.1755,

                                             51.1605,3.1782,51.1613,3.1813,51.1639,3.1836,51.1678,3.1856,51.1715,

                                             3.1923,51.1703,3.2114,51.1641,3.215,51.1636,3.2201,51.165,3.2273,

                                             51.1668,3.2312,51.1671,3.2377,51.1713,3.2438,51.1756,3.2443,

                                         51.1786,3.2448,51.1804,3.2493,51.1814,3.255,51.1846,3.2592,51.1875,3.2639,

                                         51.1866,3.269,51.1864,3.2755,51.1879,3.2797,51.1885,3.2828,51.1853,3.2841,

                                         51.1832,3.2867,51.1826,3.297,51.1824,3.2992,51.1842,3.3028,51.1853,3.3016,

                                         51.1875,3.2978,51.1885,3.3001,51.192,3.2983,51.1952,3.2969,51.1973,3.2946,

                                             51.1992,3.2999,51.2014,3.3015,51.2015,3.3032,51.2039,3.3077,

                                             51.204,3.3108,51.2041,3.3147,51.2054,3.3235,51.2156,3.3237,

                                             51.2205,3.3222,51.2238,3.3167,51.225,3.3005,51.2277,3.28,51.2417,

                                             3.276,51.2438,3.269,51.2475,3.2689,51.2492,3.2625,51.2497,3.2615,

                                             51.251,3.2942,51.2849,3.2745,51.2985,3.2359,51.329,3.2317,

                                             51.3144,3.2458,51.2943,3.2372,51.2923,3.2223,51.3142,3.216,

                                             51.3115,3.214,51.32,3.2172,51.3226,3.2151,51.3265,3.2199,51.329,3.2222,

                                         51.3239,3.2261,51.3319,3.2277,51.337,3.2212,51.3439,3.2224,51.3464,3.2163,

                                             51.349,3.2155,51.3469,3.2174,51.3454,3.2164,51.3432,3.2129,51.3454,3.21,

                                         51.3423,3.2114,51.3252,3.2153,51.2996,3.2217,51.279,3.2337,51.2364,3.2375,

                                       51.2357,3.2405,51.2301,3.2379,51.2298,3.2355,51.2316,3.2355,51.2254,3.2311,

                                       51.2248,3.2302,51.2333,3.2265,51.2273,3.2222,51.2259,3.2237,51.2325,3.2278,

                                         51.236,3.2304,51.2381,3.2147,51.2915,3.2087,51.3146,3.2063,51.3151,3.2057,

                                         51.3164,3.2082,51.3184,3.2078,51.3209,3.2054,51.318,3.2035,51.3199,3.2075,

                                          51.3233,3.2055,51.3303,3.204,51.3364,3.206,51.3425,3.2031,51.3431,3.1986,

                                       51.3367,3.1956,51.3347,3.1975,51.3422,3.2029,51.3473,3.2146,51.3508,3.2119,

                                        51.3545,3.1979,51.3494,3.1971,51.352,3.2082,51.3562,3.2076,51.3586,3.1945,

                                             51.354,3.1933,51.357,3.205,51.361,3.2047,51.3641,3.2075,51.3661,3.2064,

                                             51.3672,3.1995,51.365,3.1867,51.359,3.191,51.3457,3.1921,51.3395,

                                             3.1888,51.3316,3.1726,51.3281]]}

                                },

                                {"name":"Url","ns":"i0","value":null},

                                {"name":"Commune","ns":"i0","value":"Brugge"},         

                                {"name":"Commune_ND","ns":"i0","value":"Brugge"},

                                {"name":"Male","ns":"i0","value":56292},

                                {"name":"Female","ns":"i0","value":59954},

                                {"name":"Region","ns":"i0","value":"VLAANDEREN"},

                                {"name":"Province","ns":"i0","value":"West-Vlaanderen"},

                                {"name":"Arrondissement","ns":"i0","value":null}

                                ]

                        }

                ]}

5. Change to the WFS

In order to support this, the WFS should support an outputFormat parameter for the DescribeFeatureType and GetFeature request (which is the case in WFS 1.1).

The format used will be application/json with the typedesc and arrayoutput parameter in that order. The default are chain for typedesc and true for arrayoutput

Ex:

application/json; typedesc=concise; arrayoutput=true

6. Request

All request will be defined as an object having the following properties

• a namespaces object to carry the namespaces definition

• a request object carrying the request to perfom

If the namespaces is not required, the request can be directly provided so

{“request”:{myrequest} can be provided as {myrequest}

Each request object will carry a type property defining the kind of request to perform.

7. GetFeature Request

A GetFeature request may be defined as an object with the following properties:

• a type property having the value get

• a query object carrying the array of query to perform

• a format defining the requested output format

• an optional crs defining the requesting crs/src (default to the datastore crs)

• an optional max defining the max number of features to fetch (default is all)

• an optional version defining the version number (in the format X.Y.Z) (default is 1.0.0)

1. Query object

The query object holds the definition of a query, it is composed of :

• a type defining the name of the type name to fetch

• an optional ns providing the type namespace (i.e. a reference in the namespaces object)

• an optional props carrying an array of the properties to fetch (default is all)

• an optional filter carrying the filter to perform (either a complete form or a short form)

2. Query properties

Each property to fetch is provided either as a simple string or as an name object.

The name object has two properties

• a name defining the name of the property

• an optional ns providing the property namespace (i.e. a reference in the namespaces object)

3. Filter Object

The complete form of a filter is an object having

• an optional expr property carrying a filter expression

• an optinal ids property carrying the list of feature identifier to fetch

The filter expression defined the short form of a filter.

a) Filter Expression

The filter expression will be an object composed of a set of operators joined by an implicit and clause .

An operator will be defined as a property whose name is the operator name and its value is the array of operands like “op”:[operand1,operandi, ...,operandn]

So the object {“op”:[arg1,arg2]} defined the expression op(arg1,arg2)

the object {“op1”:[arg1,arg2], “op2”:[arg3,arg4]} defined the expression op1(arg1,arg2) and op2(arg3,arg4).

The literal(constant) expression can be a string, null,a numeric value , a date value, a measure value, a stringcode value or a geometry value.

A property expression is defined by a name object like {“name”:”propertyname” , ”ns”:”namespaceref”}

List of operators

This is the same list ans the OGC filter specification. Others operator can be added in the future

|Name |Description |Argument type |Alternate name |

|and |Logical and |N expression | |

|or |Logical or |N expression | |

|not |Logical not |1 expression | |

|== |Test equality |2 expression |= |

|!= |Test inegality |2 expression | |

|< |Less than |2 expression | |

| |Greater than |2 expression | |

|> |Greater than or equal |2 expression | |

|+ |Addition |2 expression | |

|- |substraction |2 expression | |

|* |multiplication |2 expression | |

|/ |division |2 expression | |

|like |Like operator |2 expression | |

|isnull |Test against null |1 expression | |

|isnotnull |Equivalent to not (isnull) |1 expression | |

|between |Equivalent to (Arg1 >= Arg2) and (Arg1 =”:[{“name”:”prop1”},10]}

}

}

Adding a spatial filter (short form)

{"type":"get",

"version":"1.1.0",

"max":10,

"format":"application/json",

"query":{ "type":"hiways",

“filter”:{“>=”:[{“name”:”prop1”},10],

“sp_intersect”:[{“name”:”prop2”},

{ "crs":"EPSG:4326",

"type":"POLYGON",

"card":2,

"data":[[10,10,11,10,11,11.10,11,10,10]]

}]

}

}

}

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download

To fulfill the demand for quickly locating and searching documents.

It is intelligent file search solution for home and business.

Literature Lottery

Related searches