blog.itcode.devblog.itcode.dev

A Guide for Developers Traveling Through OpenLayers - 22. Deleting Data with WFS Transaction

Among the three WFS Transaction APIs, let's cover the final step, deleting data.

A Guide for Developers Traveling Through OpenLayers - 22. Deleting Data with WFS Transaction

Among the three WFS Transaction APIs, let's cover the final step, deleting data.
RWB0104
@RWBwritten at 2022-05-30 16:46:17
A Guide for Developers Traveling Through OpenLayers

시리즈 모아보기

A Guide for Developers Traveling Through OpenLayers

22 / 23

Among the three WFS Transaction APIs, let's cover the final step, deleting data.




Using the WFS Transaction protocol, you can modify spatial data from a variety of environments capable of making API calls, such as the web or an app, rather than a database.

The processing flow in this document is as follows.

  1. Click the delete button inside the Overlay that appears when you click an object.


TXT

POST https://example.com/geoserver/wfs

XML

<wfs:Transaction
	xmlns:wfs="http://www.opengis.net/wfs"
	xmlns:ogc="http://www.opengis.net/ogc"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	service="WFS"
	version="1.0.0"
	xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd">
	<wfs:Delete typeName="layer_name">
		<ogc:Filter>
			<ogc:FeatureId fid="layer_name.66" />
		</ogc:Filter>
	</wfs:Delete>
</wfs:Transaction>

All API calls up to now have been made via GET, but every WFS Transaction request is made via POST. You can declare the data to add by entering the above XML format in the request body.

  • The target table is layer_name.
    • Specified via the typeName property of the wfs:Update tag.
  • Conditions are specified with the ogc:Filter tag, following the OGC Filter spec.

Since this is a feature for deleting data, no separate spatial data is needed — the data is deleted as long as the condition is set correctly.




You can check an example implementing this at OpenLayers6 Sandbox - WFS Transaction Delete.

# GIS# GeoServer# OpenLayers# WFS
ship
blog.itcode.dev

Notes from the π-th Alpaca

7.0.1
Developed by RWB since 2021.057th upgraded at 2026.08