[gdal-dev] Multipolygon errors

Federico Jurio federicojurio at suremptec.com.ar
Mon May 26 12:33:43 PDT 2014


Hi, once again i'm here with an issue.

I am trying to rederize a multipolygon geometry without success. Here is
the wkt

POLYGON ((-54.874213174672484 34.043827148471607,-15.258888807860258
> 50.078601296943226,-15.258888807860258
> 5.432759550218335,-55.188620510917026
> 10.777684266375541,-54.874213174672484
> 34.043827148471607),(-49.843695794759817
> 29.013309768558948,-50.472510467248902
> 16.122608982532746,-20.603813524017465
> 11.720906275109165,-21.232628196506546
> 39.388751864628816,-49.843695794759817 29.013309768558948))


I have tried many different ways

*Case #1*
OGRGeometryCollection * pmultigeom = new OGRGeometryCollection();
int gerror = pmultigeom->importFromWkt(&pwkt);

*pwkt is a char* that contains the wkt that i have mentioned before.*

*Case #2*
OGRMultiPolygon * pmultigeom = new OGRMultiPolygon();
int gerror = pmultigeom->importFromWkt(&pwkt);

Result: In both cases importFromWkt() returns 5, which means
OGRERR_CORRUPT_DATA

*Case #3*
std::vector<OGRFeature *> featurecache;
...
for (size_t nfeat = 0; nfeat < totalcachefeatures; nfeat++) {
            OGRGeometryCollection * pmultigeom =
                  dynamic_cast<OGRGeometryCollection
*>(featurecache[nfeat]->GetGeometryRef());
...
}

Result: pmultigeom = NULL

*Case #4*
std::vector<OGRFeature *> featurecache;
...
for (size_t nfeat = 0; nfeat < totalcachefeatures; nfeat++) {
OGRGeometryCollection * pmultigeom = new OGRGeometryCollection();

pmultigeom->addGeometryDirectly(featurecache[nfeat]->GetGeometryRef());
...
}

*Case #5*
std::vector<OGRFeature *> featurecache;
...
for (size_t nfeat = 0; nfeat < totalcachefeatures; nfeat++) {
OGRGeometryCollection * pmultigeom = new OGRGeometryCollection();
            pmultigeom->addGeometry(featurecache[nfeat]->GetGeometryRef());
...
}

In both cases only shows one of the two geometries and i don't know why
only one.

Any advice would be greatly appreciated. Thank you for your time.
Best regards

-- 
Federico Jurio
SUR Emprendimientos Tecnológicos

Perú 345  Piso 5to Oficina "B" (C1067AAG)
Ciudad de Buenos Aires, Argentina
Tel. +54 (11) 4342-2976/84
federicojurio at suremptec.com.ar
www.suremptec.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20140526/a2b36bd6/attachment.html>


More information about the gdal-dev mailing list