Return should be freed with msGEOSFreeWKT */
| 622 | |
| 623 | /* Return should be freed with msGEOSFreeWKT */ |
| 624 | char *msGEOSShapeToWKT(shapeObj *shape) |
| 625 | { |
| 626 | #ifdef USE_GEOS |
| 627 | GEOSGeom g; |
| 628 | |
| 629 | if(!shape) |
| 630 | return NULL; |
| 631 | |
| 632 | /* if we have a geometry, we should update it*/ |
| 633 | msGEOSFreeGeometry(shape); |
| 634 | |
| 635 | shape->geometry = (GEOSGeom) msGEOSShape2Geometry(shape); |
| 636 | g = (GEOSGeom) shape->geometry; |
| 637 | if(!g) return NULL; |
| 638 | |
| 639 | return GEOSGeomToWKT(g); |
| 640 | #else |
| 641 | msSetError(MS_GEOSERR, "GEOS support is not available.", "msGEOSShapeToWKT()"); |
| 642 | return NULL; |
| 643 | #endif |
| 644 | } |
| 645 | |
| 646 | void msGEOSFreeWKT(char* pszGEOSWKT) |
| 647 | { |
no test coverage detected