[gdal-dev] WFS-T using OGR

Ahmed Tolba Ahmed.Tolba at schiebel.net
Fri Jan 27 02:59:21 PST 2017


Hi
Thanks for your answer.

I tried to do what you suggested, but I get " Can not insert the feature, because we didn't manage to parse the .XSD schema "

Here is my code:

m_wfs_t = OGRSFDriverRegistrar::Open("WFS:http://192.168.139.128/cgi-bin/tinyows.exe?SERVICE=WFS&VERSION=1.0.0",true);

      OGRLayer *poLayer;
      poLayer = m_wfs_t->GetLayerByName("tows:poi_ais");

      OGRFeature *poFeature;
      poFeature = OGRFeature::CreateFeature( poLayer->GetLayerDefn() );
      poFeature->SetField( "Name", "poiAhmed" );
      poFeature->SetFID(1000);
      poFeature->SetField("speed",10);

      OGRPoint pt;
      pt.setX( 120 );
      pt.setY( 240 );
      poFeature->SetGeometry( &pt );

      if( poLayer->CreateFeature( poFeature ) != OGRERR_NONE )
      {
            std::cout <<"error creating a feature"<<endl;

      }

From: Even Rouault [mailto:even.rouault at spatialys.com]
Sent: Friday, January 27, 2017 11:50 AM
To: gdal-dev at lists.osgeo.org<mailto:gdal-dev at lists.osgeo.org>
Cc: Ahmed Tolba
Subject: Re: [gdal-dev] WFS-T using OGR


On vendredi 27 janvier 2017 10:20:36 CET Ahmed Tolba wrote:

> I followed the example here. http://www.gdal.org/ogr_apitut.html

>

> How would I set a transaction through a webserver.

>

> The tutorial only shows how to do it on disk.

>

> Is it possible to write a transaction WFS-T using a server call ?



Yes WFS-T (1.0.0 or 1.1.0 only. code has not yet been upgraded to support WFS-T 2.0.0 as far as I remember) is supported in a similar way as editing other datasources.

>

>

> m_wfs_t =

> OGRSFDriverRegistrar::Open("http://192.168.139.128/cgi-bin/tinyows.exe?SERV

> ICE=WFS&VERSION=1.0.0",true);



Prefix the endpoint with WFS:



so



Open("WFS:http://192.168.139.128/cgi-bin/tinyows.exe?SERVICE=WFS&VERSION=1.0.0", true)



OGRFeature *poFeature;

> poFeature = OGRFeature::CreateFeature( poLayer->GetLayerDefn() );

> poFeature->SetField( "Name", "poiAhmed" );

> OGRPoint pt;

> pt.setX( 120 );

> pt.setY( 240 );

> poFeature->SetGeometry( &pt );

> if( poLayer->CreateFeature( poFeature ) != OGRERR_NONE )

> {

> printf( "Failed to create feature in shapefile.\n" );

> exit( 1 );

> }

> _______________________________________________

> gdal-dev mailing list

> gdal-dev at lists.osgeo.org<mailto:gdal-dev at lists.osgeo.org>

> https://lists.osgeo.org/mailman/listinfo/gdal-dev





--

Spatialys - Geospatial professional services

http://www.spatialys.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20170127/ddbf72dd/attachment-0001.html>


More information about the gdal-dev mailing list