A library to convert geojson features to WFS-T-2.0 xml strings.

Usage no npm install needed!

<script type="module">
  import geojsonToWfsT2 from '';



npm version Build Status

A library to create string Web Feature Service XML from geojson. As a string formatting library, geojson-to-wfst-2 has only one dependency and will work in any environment.


get the library by executing

npm install geojson-to-wfs-t-2


git clone

and import/require-ing es6 or transpiled es5 commonjs, UMD, or es modules from geojson-to-wfs-t-2/dist/.


import wfs from 'geojson-to-wfs-t-2';

const nullIsland = {
  type: 'Feature',
  properties: {place_name: 'null island'},
  geometry: {
    type: 'Point',
    coordinates: [0, 0]
  id: 'feature_id'
const params = {geometry_name: 'geom', layer: 'my_lyr', ns: 'my_namespace'};

// create a stringified transaction inserting null island
  wfs.Insert(nullIsland, params),
    nsAssignments: {
      my_namespace: ''

// create a stringified transaction updating null island's name
  wfs.Update({properties: {place_name: 'not Atlantis'}, id: }),
  {nsAssignments: ...}
// same deal, but deleting it
  wfs.Delete({id:}, params),
  {nsAssignments: ...}

See for the full API documentation.

Further notes:

  • While you should make sure to secure permissions to your data elsewhere (such as the geoserver layer-level permissions), you excluding or encapsulating dangerous actions like Delete is a good idea.

  • The functions Insert, Update, Replace, Delete in this module have remained uppercase (1) to remain similar to their xml names and (2) to avoid the keyword delete. If you would prefer to adhere to camelcase naming, consider aliasing the functions on import, like import {Insert as insert} from '...'


Features, refactors, documentation, and tests are welcome! To contribute, branch or fork this repo, optionally open an issue, and then open a pull request. Please include tests and well-commented commits in all work.

Here's an example script to start developing a feature on this project:

git clone # or your fork
cd geojson-to-wfs-t-2
git checkout -b informative-feature-branch
npm install