[gdal-dev] Setting Geometry using WFS-T/OGR/GDAL

Ahmed Tolba Ahmed.Tolba at schiebel.net
Wed Feb 8 03:41:47 PST 2017


I enabled the debugging feature in GDAL.   I get Invalid Geometry in the debug output. In the database I specified the geom field to be a Geometry field.  What else I'm missing.
Please I need help :)

Thanks so much,
Ahmed

From: Ahmed Tolba
Sent: Wednesday, February 08, 2017 12:05 PM
To: gdal-dev at lists.osgeo.org
Subject: Setting Geometry using WFS-T/OGR/GDAL

Hi All,

I'm trying to set a Geometry which is a polygon using the following code:

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

      OGRFeature *poFeature;


      poFeature = OGRFeature::CreateFeature( poLayer->GetLayerDefn() );
      poFeature->SetField( "name", "ahmed" );


      OGRLinearRing ring1;
      OGRPolygon poly;

      ring1.addPoint(1116651.439379124, 637392.6969887456);
      ring1.addPoint(1188804.0108498496, 652655.7409537067);
      ring1.addPoint(1226730.3625203592, 634155.0816022386);
      ring1.addPoint(1281307.30760719, 636467.6640211721);
      ring1.closeRings();
      poly.addRing(&ring1);
      poFeature->SetGeometry(&poly);

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

      }


But I get Error : Transaction Response. I don't know whether the problem is in my server or a problem in OGR itself.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20170208/385033dc/attachment.html>


More information about the gdal-dev mailing list