I am trying to load vector with the following code:

 var sourceWFS = new ol.source.Vector({
      loader: function(extent) {
       $.ajax('http://************/geoserver/Viva/ows', {
            type: 'GET',
            data: {
            service: 'WFS',
            version: '1.1.0',
            request: 'GetFeature',
            typename: 'Viva:building',
            srsname: 'EPSG:4326',
            bbox: extent.join(',') + ',EPSG:4326'

        }).done(function(response) {

I don`t seem to be able to get any features. I have a suspicion that I am not setting the typename right. The data is points of buildings.

The url in the geoserver preview layer is the following:


I have tested loading a GeoJson layer and it works without fail from the same server and data by using the url-method.

The end goal is to add a new point with WFS-t.

I got most of my code from this example:



I have changed the ol.format.WFS like follow:

var formatWFS = ol.format.WFS({
featureNS: "http://serverURL:8080/geoserver/vivadata",
featureType: "Viva:buildingType"

and I get the following error in the console:

Uncaught TypeError: Cannot read property 'writeTransaction' of undefined at transactWFS

This is the block of code for transactWFS:

var transactWFS = function(mode, a) {
      var node;
      switch (mode) {
        case 'insert':
          node = formatWFS.writeTransaction([a], null, null, formatGML);
        case 'update':
          node = formatWFS.writeTransaction(null, [a], null, formatGML);
        case 'delete':
          node = formatWFS.writeTransaction(null, null, [a], formatGML);

and this is my draw function:

var DrawControl = function(opt_options) {
        var options = opt_options || {};
        this.active = options.active || false;
        var draw = new ol.interaction.Draw({
            source: options.source,
            type: 'Point',
            geometryName: 'geom'

        draw.on('drawstart', function(t) {

        //Sets building properties when addBuilding-button isclicked
        draw.on('drawend', function(t) {
        var a = t.feature;

            prim_add: document.getElementById('inpPriAddress').value,
            sec_add: document.getElementById('inpSecAddress').value,
            tert_add: document.getElementById('inpTerAddress').value,
            build_own: document.getElementById('inpHouseOwner').value,
        transactWFS('insert', a);
  • Check the order of coordinates in bbox, it should be latitude-longitude for EPSG:4326 if you use WFS 1.1.0.
    – user30184
    Nov 9, 2016 at 21:20
  • also your BBOX will be in the map's SRS not necessarily 4326
    – Ian Turton
    Nov 10, 2016 at 9:25
  • I am also facing same issue sir
    – user28536
    Jul 19, 2017 at 9:13

1 Answer 1


After long struggle and reimplementation of my Geoserver, I found the settings that allow WFS-t on the server's side.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.