[gdal-dev] WFS-T using OGR

Even Rouault even.rouault at spatialys.com
Fri Jan 27 02:50:04 PST 2017


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
> 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/b3fe9a35/attachment.html>


More information about the gdal-dev mailing list