Opened 17 years ago

Closed 16 years ago

#1497 closed enhancement (wontfix)

Use EnhancedPrecisionOp for difference and intersection operations

Reported by: fabien@… Owned by: Mateusz Łoskot
Priority: normal Milestone: 1.6.0
Component: OGR_SF Version: svn-trunk
Severity: minor Keywords: geos intersection precision
Cc:

Description (last modified by Mateusz Łoskot)

We can use the new geos operations to compute difference and intersection (and possibly other). Algorithms are more robusts and there is less error messages like "no diredge found".

The little patch:

diff -r -N  gdal-1.4.0/ogr/ogrgeometry.cpp gdal-1.4.0-fb/ogr/ogrgeometry.cpp 
167a168,174
> #ifdef HAVE_GEOS
> #if GEOS_VERSION_MAJOR >= 3
> #include <geos/precision/EnhancedPrecisionOp.h>
> #endif
> #endif
> 
> 
1724c1731,1735
<         hGeosProduct = GEOSIntersection( hThisGeosGeom, hOtherGeosGeom );
---
> #if GEOS_VERSION_MAJOR >= 3
>         hGeosProduct = (GEOSGeometry*)geos::precision::EnhancedPrecisionOp::intersection(( geos::geom::Geometry*) hThisGeosGeom, (geos::geom::Geometry*)hOtherGeosGeom );
> #else
>       hGeosProduct = GEOSIntersection( hThisGeosGeom, hOtherGeosGeom );
> #endif
1862a1874,1876
> #if GEOS_VERSION_MAJOR >= 3
>         hGeosProduct = (GEOSGeometry*)geos::precision::EnhancedPrecisionOp::difference(( geos::geom::Geometry*) hThisGeosGeom, (geos::geom::Geometry*)hOtherGeosGeom );
> #else
1863a1878
> #endif

Change History (7)

comment:1 by warmerdam, 17 years ago

Description: modified (diff)
Priority: highestnormal

comment:2 by Mateusz Łoskot, 17 years ago

Description: modified (diff)

comment:3 by Mateusz Łoskot, 17 years ago

Status: newassigned

Fabien,

As I've checked, GEOS is supposed to use these new enhancements automatically. I'm not sure we should call it directly from OGR.

comment:4 by Mateusz Łoskot, 16 years ago

Keywords: geos intersection precision added
Milestone: 1.6.0
Version: unspecifiedsvn-trunk

My previous diagnosis was not precise. The old GEOS operations do not automatically use enhanced precision. So, Fabien's idea is a good one.

GDAL requires GEOS 2.2.0 which provides initial version of enhanced precision operations. Following Fabien's patch, we can safely assume that GEOS 3.0.0 provides complete implementation. I'll apply this patch to trunk only (setting milestone to 1.6.0)

comment:5 by Mateusz Łoskot, 16 years ago

There is one issue with this proposal, as I see the EnhancedPrecisionOp is not available in GEOS C API. In the OGR we moved from GEOS C++ API to C API. Now, the question is if we want to partially move back to the C++, if we want to use the enhanced precision operations.

Frank,

What is your opinion?

comment:6 by Mateusz Łoskot, 16 years ago

To complete the discussion: (geos-devel) Any plan to add EnhancedPrecisionOp to C API ?

comment:7 by Mateusz Łoskot, 16 years ago

Resolution: wontfix
Status: assignedclosed

I'm closing this ticket due to the fact the EnhancedPrecisionOp is not available through GEOS C API. We may get back to this when/if the C API is extended.

Note: See TracTickets for help on using tickets.