|
Re: Encounter Segmentation Fault with GEOS 2.2.2: msg#00070gis.geos.devel
Sheng Liang (SH/CBC) wrote: > Hi: I encountered an error of "Segmentation Fault" with GEOS 2.2.2. > What I am doing is to get intersection of two polygons. The error > happens to the specific polygong: POLYGON ((125.331 0,3.35823e-06 > 125.331,-125.331 6.71646e-06,-1.00747e-05 -125.331,125.331 0)) and > POLYGON ((245.331 120,120 245.331,-5.331 120,120 -5.331,245.331 120)) > There is no error to others polygons. So I think it must be an error > of GEOS 2.2.2 code. > > My code is : GEOSGeom aPolygon1,aPolygon2; string aString1("POLYGON > ((125.331 0,3.35823e-06 125.331,-125.331 6.71646e-06,-1.00747e-05 > -125.331,125.331 0))"); > > string aString2("POLYGON ((245.331 120,120 245.331,-5.331 120,120 > -5.331,245.331 120))"); > > aPolygon1 = GEOSGeomFromWKT(aString1.data()); > aPolygon2 = GEOSGeomFromWKT(aString2.data()); I'm suer in 99% that the problem is in your code above. You should not access internal buffer of std::string with data() member function. It should be used in very rare cases because it breaks OOP rule of encapsulation! It's available only for C compatibility. GEOSGeomFromWKT expects to get const char* : Geometry *GEOSGeomFromWKT(const char *wkt); so, you should call it as follows: aPolygon1 = GEOSGeomFromWKT(aString1.c_str()); std::string::c_str() returns const char*. Cheers -- Mateusz Loskot http://mateusz.loskot.net |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Assertions in CoordinateArraySequence: 00070, Mateusz Loskot |
|---|---|
| Next by Date: | Re: Assertions in CoordinateArraySequence: 00070, Charlie Savage |
| Previous by Thread: | Encounter Segmentation Fault with GEOS 2.2.2i: 00070, Sheng Liang (SH/CBC) |
| Next by Thread: | RE: Encounter Segmentation Fault with GEOS 2.2.2: 00070, Sheng Liang (SH/CBC) |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |