Skip to content

WFS client

Armin Retterath edited this page Apr 17, 2024 · 3 revisions

Using remote WFS for select options (since 2024/04)

The old mapbender wfs-conf model supports the definition of special html form elements as select boxes, date pickers, ... :

WFS Configuration

As the definition of select options had to be hardcoded, the concept was not very flexible. Because there are many WFS based datasources in a SDI, it will be a good alternative have the possibility to load select options live from remote WFS. This extension was done in 2024. There is a new HTML template called SelectboxWfs where a user can put in some special json configuration parameters.

Bildschirmfoto von 2024-04-17 15-02-19

Example

{
  "wfs_id": 24,
  "featuretype_id": 64,
  "element_ids": [763, 764],
  "element_id_order": 1,
  "select_id": "gemarkung",
  "option_empty": false,
  "option_value_ltrim": "07",
  "option_value_cast_type": "int",
  "option_value_template": "%%element[0]%%",
  "option_text_template": "%%element[0]%% (%%element[1]%%)" 
}

The resource ids are from the local mapbender database. This make the system independent from service urls. The select_id field contains the form id which will be submitted. The WFS request pull some property names (defined by element_ids). They should be unique. If some property does not match the client element, it could be trimmed and casted. In the upper case the option_value element[0] contains strings like 070234 and the WFS which will be invoked has defined integer values like 234 for the element gemarkung. The values will be generated by the template, then trimmed and then casted as integer.

HTML Result

<select id='gemarkung'><option></option>
	<option value='2797'>Aach (072797) - Kreis Trier-Saarburg</option>
	<option value='3904'>Abenheim (073904) - Kreis Stadt Worms</option>
	<option value='2334'>Abentheuer (072334) - Kreis Birkenfeld</option>
	<option value='2071'>Abtweiler (072071) - Kreis Bad Kreuznach</option>
	<option value='1210'>Acht (071210) - Kreis Mayen-Koblenz</option>
</select>
Clone this wiki locally