[gdal-dev] OGRGeometry creation

mchapman at texelinc.com mchapman at texelinc.com
Fri Nov 23 12:35:27 EST 2007


Look at your if statement.  You are saying if ier equals err_none is true when it should be ier not equal ogr_errnone.  U have a logical operator wrong for error check. Your code is the problem.

Martin

Sent via BlackBerry by AT&T

-----Original Message-----
From: "Yuriy Rusinov" <yrusinov at gmail.com>

Date: Fri, 23 Nov 2007 15:24:35 
To:gdal-dev at lists.osgeo.org
Subject: [gdal-dev] OGRGeometry creation


Dear Colleagues !

I try to create geometry object using wkt-string. I do 
    OGRGeometry * poOGRGeom;
    const char* obWkt = "POLYGON((...,...))";
    char * pszWkt = new char [strlen (obWkt)];
     strncpy (pszWkt, obWkt, strlen (obWkt));
    OGRSpatialReference *ref = new OGRSpatialReference ();

    OGRErr ier = OGRGeometryFactory::createFromWkt (&pszWkt, ref, &poOGRGeom); 
    if (ier == OGRERR_NONE) 
    {
        char ** wkt = new char*;
        wkt[0] = new char[1000];
        poOGRGeom->exportToWkt (wkt);
        ...
    }

This code works fine under Linux, but under Windows (Visual Studio 2003) it fails on call of any function-member OGRGeometry class. Where is the troubles ? 

-- 
Best regards,
Sincerely yours,
Yuriy Rusinov _______________________________________________
gdal-dev mailing list
gdal-dev at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev


More information about the gdal-dev mailing list