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:[email protected]]
Sent: Friday, January 27, 2017 11:50 AM
To: [email protected]<mailto:[email protected]>
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

> [email protected]<mailto:[email protected]>

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





--

Spatialys - Geospatial professional services

http://www.spatialys.com
_______________________________________________
gdal-dev mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to