Skip to content

Library of some interface functions to Geoserver (Incubating) - Maintained by @liamoehlman

Notifications You must be signed in to change notification settings

liamoehlman/geoserver-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About GeoServer-js

GeoServer-js is a toolset designed to make accessing and querying a GeoServer instance much more user friendly.

For the time being GeoServer-js is dependant on Tile5

Usage

  • GEOSERVER.cql.parseCQL(query, params)

    • Takes the query json and params and returns an array of cql queries
      • params : { maxPoints : 50
        }
  • GEOSERVER.ogc.parseOGC(query)

    • Takes the query json and returns an array with a single value which is the ogc filter
  • GEOSERVER.buildRequest(requestParams, params, json, callback)

    • Returns an array of objects, each of which is the querystring portion of the geoserver request.

      • requestParams : { service: 'WFS', version: '1.1.0', request: 'GetFeature', maxFeatures: 200, outputFormat: 'json', typeName : null, propertyName : } typeName must be specified

      • params : { queryType: "ogc", maxPoints: undefined }

      queryType can either be ogc, which returns an xml-type filter or cql which returns a sql type filter - If the type is ogc an array of one will be returned, cql can be any length

      • json - The json to be transformed into a cql query
      • callback - The function to handle the returned array

Additional

Chained query example

{
    operator: 'AND',
    conditions: [{
        "type": "like",
        "args": {
            "property": "Name",
            "value": "Cottage"
        }
    }, {
        type: 'compound',
        args: {
            operator: 'OR',
            conditions: [{
                "type": "like",
                "args": {
                    "property": "Name",
                    "value": "Hotel"
                }
            }, {
                "type": "spatial.bbox",
                "args": {
                    "property": "the_geom",
                    "min": "-28.96 138.08",
                    "max": "-10.27 153.59"
                }
            },  {
                type: 'compound',
                args: {
                    operator: 'OR',
                    conditions: [{
                        "type": "like",
                        "args": {
                            "property": "Name",
                            "value": "Hotel"
                        }
                    }, {
                        "type": "spatial.bbox",
                        "args": {
                            "property": "the_geom",
                            "min": "-28.96 138.08",
                            "max": "-10.27 153.59"
                        }
                    }]
                }
			}]
        }
    }

This returns the following : (Name LIKE '%Cottage%' AND (Name LIKE '%Hotel%' OR BBOX(the_geom, -28.96, 138.08, -10.27, 153.59) OR (Name LIKE '%Hotel%' OR BBOX(the_geom, -28.96, 138.08, -10.27, 153.59))))

About

Library of some interface functions to Geoserver (Incubating) - Maintained by @liamoehlman

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published