Lizmap Web Client 3.11.0

WFSRequest extends OGCRequest
in package

Tags
see
https://en.wikipedia.org/wiki/Web_Feature_Service.

Table of Contents

Constants

DEFAULT_OUTPUT_SRID  : mixed = 4326
Default output SRID when no SRSNAME is provided on the WFS GetFeature request (EPSG:4326 — the historical WFS default).

Properties

$genericGetFeatureParameters  : array<string, string>
$hitsGetFeatureParameters  : array<string, string>
$appContext  : AppContextInterface
$datasource  : null|object
$editingContext  : bool
$params  : array<string|int, mixed>
$project  : Project
$qgisLayer  : null|qgisVectorLayer
$repository  : Repository
$requestXml  : null|string
$selectFields  : array<string|int, string>
$services  : lizmapServices
$tplExceptions  : string
$wfs_typename  : null|string

Methods

__construct()  : mixed
constructor.
buildGetFeatureHitsParameters()  : array<string, string>
Build GetFeature request parameters to get number of features for a type name and optional other parameters.
buildGetFeatureParameters()  : array<string, string>
Build GetFeature request parameters for a type name and optional other parameters.
checkingTypename()  : int
getEditingContext()  : bool
param()  : mixed
Get the value of a request parameter. If not defined, gets its default value.
parameters()  : array<string, string>
Provide the parameters with the lizmap extra parameters for filtering the request.
process()  : object
Process the OGC Request Checks the request parameter and performs the right method.
requestedTypename()  : string
Get the requested typename based on TYPENAME or FEATUREID parameter.
setEditingContext()  : bool
Set the edition context for request.
buildQueryBase()  : string
Build the base SQL query to fetch data from the database.
constructUrl()  : string
Build the URL to request QGIS Server.
getBboxSql()  : string
Get the SQL clause to instersects bbox in the request parameters.
getDatasourceSql()  : string
Get the SQL filter configured in QGIS layer datasource.
getFeatureIdFilterExp()  : string
getfeaturePostgres()  : OGCResponse
Queries The PostGreSQL Server for getFeature.
getfeatureQgis()  : OGCResponse
Queries Qgis Server for getFeature.
getQueryOrder()  : string
loadXmlString()  : mixed
logRequestIfError()  : mixed
Log if the HTTP code is a 4XX or 5XX error code.
parseExpFilter()  : false|string
parseFeatureId()  : string
parseSrsnameSrid()  : null|int
Parse a WFS SRSNAME string and return its SRID.
process_describefeaturetype()  : OGCResponse
process_getcapabilities()  : OGCResponse
Perform an OGC GetCapabilities Request.
process_getfeature()  : OGCResponse
request()  : OGCResponse
Request QGIS Server.
serviceException()  : OGCResponse
Provide an OGC Service Exception result.
setGeojsonSql()  : string
validateFilter()  : false|string
Parses and validate a filter for postgresql.
getResultTypeHitsSql()  : string
Get the SQL used to count the features.

Constants

DEFAULT_OUTPUT_SRID

Default output SRID when no SRSNAME is provided on the WFS GetFeature request (EPSG:4326 — the historical WFS default).

protected mixed DEFAULT_OUTPUT_SRID = 4326

Properties

$genericGetFeatureParameters

public static array<string, string> $genericGetFeatureParameters = array('SERVICE' => 'WFS', 'VERSION' => '1.0.0', 'REQUEST' => 'GetFeature', 'OUTPUTFORMAT' => 'GeoJSON')

Generic GetFeature request parameters

$hitsGetFeatureParameters

public static array<string, string> $hitsGetFeatureParameters = array('RESULTTYPE' => 'hits')

The special hits GetFeature request parameters to get number of features

$datasource

protected null|object $datasource

datasource parameters

$editingContext

protected bool $editingContext = false

apply edition context for request

$params

protected array<string|int, mixed> $params

$selectFields

protected array<string|int, string> $selectFields = array()

the fields to select

$tplExceptions

protected string $tplExceptions = 'lizmap~wfs_exception'

selector of a template

$wfs_typename

protected null|string $wfs_typename

the requested typename

Methods

__construct()

constructor.

public __construct(Project $project, array<string|int, mixed> $params, lizmapServices $services[, null|string $requestXml = null ]) : mixed
Parameters
$project : Project

the project

$params : array<string|int, mixed>

the params array

$services : lizmapServices
$requestXml : null|string = null

the params array

buildGetFeatureHitsParameters()

Build GetFeature request parameters to get number of features for a type name and optional other parameters.

public static buildGetFeatureHitsParameters(string $typeName[, array<string, string> $otherParameters = array() ]) : array<string, string>
Parameters
$typeName : string

The type name of features

$otherParameters : array<string, string> = array()

Optional, other parameters to add to the request

Return values
array<string, string> —

The parameters

buildGetFeatureParameters()

Build GetFeature request parameters for a type name and optional other parameters.

public static buildGetFeatureParameters(string $typeName[, array<string, string> $otherParameters = array() ]) : array<string, string>
Parameters
$typeName : string

The type name of features

$otherParameters : array<string, string> = array()

Other parameters to add to the request

Return values
array<string, string> —

The parameters

checkingTypename()

public checkingTypename() : int
Return values
int —

An HTTP code

getEditingContext()

public getEditingContext() : bool
Return values
bool —

The edition context for request

param()

Get the value of a request parameter. If not defined, gets its default value.

public param(string $name[, mixed $defaultValue = null ][, bool $useDefaultIfEmpty = false ]) : mixed
Parameters
$name : string

the name of the request parameter

$defaultValue : mixed = null

the default returned value if the parameter doesn't exists

$useDefaultIfEmpty : bool = false

true: says to return the default value if the parameter value is ""

Return values
mixed —

the request parameter value

parameters()

Provide the parameters with the lizmap extra parameters for filtering the request.

public parameters() : array<string, string>

Lizmap_User, Lizmap_User_Groups, Lizmap_Override_Filter have been added to the OGC request parameters. Filter data by login if necessary as configured in the plugin for login filtered layers.

Return values
array<string, string> —

the WFS request parameters with Lizmap extra parameters for filtering request

process()

Process the OGC Request Checks the request parameter and performs the right method.

public process() : object
Return values
object —

The request result with HTTP code, response mime-type, response data (properties $code, $mime, $data, $cached)

requestedTypename()

Get the requested typename based on TYPENAME or FEATUREID parameter.

public requestedTypename() : string
Return values
string —

the requested typename

setEditingContext()

Set the edition context for request.

public setEditingContext(bool $editingContext) : bool
Parameters
$editingContext : bool

The edition context for request

Return values
bool —

The edition context for request

buildQueryBase()

Build the base SQL query to fetch data from the database.

protected buildQueryBase(mixed $cnx, mixed $params, mixed $wfsFields[, bool $isHitsRequest = false ]) : string
Parameters
$cnx : mixed

Database connection

$params : mixed

Request parameters

$wfsFields : mixed

List of WFS fields

$isHitsRequest : bool = false

True if the request must only get the features count

Return values
string

constructUrl()

Build the URL to request QGIS Server.

protected constructUrl() : string
Return values
string —

The URL to use to request QGIS Server

getBboxSql()

Get the SQL clause to instersects bbox in the request parameters.

protected getBboxSql(array<string, string> $params) : string
Parameters
$params : array<string, string>

the request parameters

Return values
string —

the SQL clause to instersects bbox in the request parameters or empty string

getDatasourceSql()

Get the SQL filter configured in QGIS layer datasource.

protected getDatasourceSql() : string
Return values
string —

The SQL filter enclosed with parenthesis

getFeatureIdFilterExp()

protected getFeatureIdFilterExp(string $featureid, string $typename, qgisVectorLayer $qgisLayer) : string
Parameters
$featureid : string

The FEATUREID parameter

$typename : string

The layer's typename from TYPENAME or FEATUREID parameter

$qgisLayer : qgisVectorLayer

The QGIS layer based on typename

Return values
string —

The QGIS expression based on FEATUREID parameter

getQueryOrder()

protected getQueryOrder(mixed $cnx, mixed $params, mixed $wfsFields) : string
Parameters
$cnx : mixed
$params : mixed
$wfsFields : mixed
Return values
string

loadXmlString()

protected loadXmlString(mixed $xmldata, mixed $name) : mixed
Parameters
$xmldata : mixed
$name : mixed

logRequestIfError()

Log if the HTTP code is a 4XX or 5XX error code.

protected logRequestIfError(int $code, array<string, string> $headers) : mixed
Parameters
$code : int

The HTTP code of the request

$headers : array<string, string>

The headers of the response

parseExpFilter()

protected parseExpFilter(mixed $cnx, mixed $params) : false|string
Parameters
$cnx : mixed
$params : mixed
Return values
false|string

parseFeatureId()

protected parseFeatureId(mixed $cnx, mixed $params) : string
Parameters
$cnx : mixed
$params : mixed
Return values
string

parseSrsnameSrid()

Parse a WFS SRSNAME string and return its SRID.

protected parseSrsnameSrid(string $srsname) : null|int

Accepts the colon-separated forms used by WFS clients: "EPSG:4326", "urn:ogc:def:crs:EPSG::4326" The last colon-separated segment must be a positive integer.

Parameters
$srsname : string

the raw SRSNAME value

Return values
null|int —

the SRID on success, null if the input is empty or malformed

request()

Request QGIS Server.

protected request([bool $post = false ][, bool $stream = false ]) : OGCResponse
Parameters
$post : bool = false

Force to use POST request

$stream : bool = false

Get data as stream

Return values
OGCResponse —

The request result with HTTP code, response mime-type and response data (properties $code, $mime, $data)

serviceException()

Provide an OGC Service Exception result.

protected serviceException([int $code = 400 ]) : OGCResponse
Parameters
$code : int = 400

The HTTP code to return

Return values
OGCResponse —

The request result with HTTP code, response mime-type, response data (properties $code, $mime, $data, $cached)

setGeojsonSql()

protected setGeojsonSql(string $sql, jDbConnection $cnx, mixed $typename, mixed $geometryname[, int $outputSrid = 4326 ]) : string
Parameters
$sql : string
$cnx : jDbConnection
$typename : mixed
$geometryname : mixed
$outputSrid : int = 4326
Return values
string

validateFilter()

Parses and validate a filter for postgresql.

protected validateFilter(string $filter) : false|string
Parameters
$filter : string

The filter to parse

Return values
false|string —

returns the validate filter if the expression does not contains dangerous chars

getResultTypeHitsSql()

Get the SQL used to count the features.

private getResultTypeHitsSql(string $sql) : string

This is used for RESULTTYPE=hits

Parameters
$sql : string
Return values
string
On this page

Search results