Changeset: b688653f630f for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b688653f630f
Modified Files:
        geom/monetdb5/geom.c
        geom/monetdb5/geom.h
        geom/monetdb5/geom.mal
        geom/sql/40_geom.sql
Branch: sfcgal
Log Message:

ST_Simplify is now available.


diffs (72 lines):

diff --git a/geom/monetdb5/geom.c b/geom/monetdb5/geom.c
--- a/geom/monetdb5/geom.c
+++ b/geom/monetdb5/geom.c
@@ -2232,6 +2232,24 @@ wkbsubPolygonize(bat *outBAT_id, bat* bB
        return err;
 }
 
+str wkbSimplify(wkb** outWKB, wkb** geom, float* tolerance){
+       GEOSGeom geosGeometry = wkb2geos(*geom);
+       GEOSGeometry* outGeometry;
+
+       if(!(outGeometry = GEOSSimplify(geosGeometry, *tolerance))) {
+               *outWKB = NULL;
+               GEOSGeom_destroy(geosGeometry);
+               return createException(MAL, "geom.Simplify", "GEOSSimplify 
failed");
+       }
+
+       GEOSGeom_destroy(geosGeometry);
+
+       *outWKB = geos2wkb(outGeometry);
+       GEOSGeom_destroy(outGeometry);
+
+       return MAL_SUCCEED;
+}
+
 str wkbSimplifyPreserveTopology(wkb** outWKB, wkb** geom, float* tolerance){
        GEOSGeom geosGeometry = wkb2geos(*geom);
        GEOSGeometry* outGeometry;
@@ -2239,7 +2257,7 @@ str wkbSimplifyPreserveTopology(wkb** ou
        if(!(outGeometry = GEOSTopologyPreserveSimplify(geosGeometry, 
*tolerance))) {
                *outWKB = NULL;
                GEOSGeom_destroy(geosGeometry);
-               return createException(MAL, "geom.SimplifyPreserveTopology", 
"GEOSSimplifyPreserveTopology failed");
+               return createException(MAL, "geom.SimplifyPreserveTopology", 
"GEOSTopologyPreserveSimplify failed");
        }
 
        GEOSGeom_destroy(geosGeometry);
diff --git a/geom/monetdb5/geom.h b/geom/monetdb5/geom.h
--- a/geom/monetdb5/geom.h
+++ b/geom/monetdb5/geom.h
@@ -257,6 +257,7 @@ geom_export str wkbDumpPointsP(bat* part
 geom_export str dumpGeometriesGeometry(BAT *idBAT, BAT *geomBAT, const 
GEOSGeometry *geosGeometry, const char *path);
 geom_export str wkbPolygonize(wkb **res, wkb **geom);
 geom_export str wkbsubPolygonize(bat *outBAT_id, bat* bBAT_id, bat *gBAT_id, 
bat *eBAT_id, bit* flag);
+geom_export str wkbSimplify(wkb **res, wkb **geom, float *tolerance);
 geom_export str wkbSimplifyPreserveTopology(wkb **res, wkb **geom, float 
*tolerance);
 
 geom_export str geom_2_geom(wkb** resWKB, wkb **valueWKB, int* columnType, 
int* columnSRID); 
diff --git a/geom/monetdb5/geom.mal b/geom/monetdb5/geom.mal
--- a/geom/monetdb5/geom.mal
+++ b/geom/monetdb5/geom.mal
@@ -360,6 +360,8 @@ comment "Creates a GeometryCollection co
 command subPolygonize(a:bat[:wkb], g:bat[:oid], e:bat[:oid], :bit) :bat[:wkb] 
address wkbsubPolygonize
 comment "Creates a GeometryCollection containing possible polygons formed from 
the constituent linework of a set of geometries.";
 
+command Simplify(a:wkb, t:flt) :wkb address wkbSimplify
+comment "Returns a \"simplified\" version of the given geometry using the 
Douglas-Peucker algorithm.";
 command SimplifyPreserveTopology(a:wkb, t:flt) :wkb address 
wkbSimplifyPreserveTopology
 comment "Returns a \"simplified\" version of the given geometry using the 
Douglas-Peucker algorithm.";
 
diff --git a/geom/sql/40_geom.sql b/geom/sql/40_geom.sql
--- a/geom/sql/40_geom.sql
+++ b/geom/sql/40_geom.sql
@@ -4384,7 +4384,7 @@ CREATE AGGREGATE ST_Polygonize(geom Geom
 --CREATE FUNCTION ST_RemoveRepeatedPoints RETURNS EXTERNAL NAME
 --CREATE FUNCTION ST_SharedPaths RETURNS EXTERNAL NAME
 --CREATE FUNCTION ST_Shift_Longitude RETURNS EXTERNAL NAME
---CREATE FUNCTION ST_Simplify RETURNS EXTERNAL NAME
+CREATE FUNCTION ST_Simplify(geom1 Geometry, tolerance real) RETURNS Geometry 
EXTERNAL NAME geom."Simplify";
 CREATE FUNCTION ST_SimplifyPreserveTopology(geom1 Geometry, tolerance real) 
RETURNS Geometry EXTERNAL NAME geom."SimplifyPreserveTopology";
 --CREATE FUNCTION ST_Split RETURNS EXTERNAL NAME
 --CREATE FUNCTION ST_Union(geometry set geoms)?????
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to