You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@sedona.apache.org by "paleolimbot (via GitHub)" <gi...@apache.org> on 2025/10/26 01:48:47 UTC

[I] Implement ST_Simplify() [sedona-db]

paleolimbot opened a new issue, #244:
URL: https://github.com/apache/sedona-db/issues/244

   @joonaspessi kindly did some research on the PostGIS implementation of ST_Simplify(), which is not implemented as a thin wrapper around GEOS:
   
   Actually started the implementation of `ST_Simplify` but noticed that the PostGIS has different behavior for collapsed geometries and collection types in comparison to [GEOS implementation](https://libgeos.org/doxygen/classgeos_1_1simplify_1_1DouglasPeuckerSimplifier.html). 
   
   Achieving full PostGIS compatibility (including all the params) would probably require custom Rust implementation.
   
   - Both PostGIS and Sedona-DB uses now GEOS for ST_SimplifyPreserveTopology
       - https://github.com/postgis/postgis/blob/master/postgis/lwgeom_geos.c#L935 - Entry point
       - https://github.com/postgis/postgis/blob/master/postgis/lwgeom_geos.c#L966 - GEOS function call
   - PostGIS uses custom implementation for ST_Simplify
      - https://github.com/postgis/postgis/blob/master/postgis/lwgeom_functions_analytic.c#L58 - Entry point
      - https://github.com/postgis/postgis/blob/master/liblwgeom/lwgeom.c#L1851 - Core custom implementation
   
   I wonder if the `geo` implementation of Simplify (if it exists) already ticks some of these boxes...since it is a more involved function to implement, it is probably worth going straight for a custom or geo-generic-alg based approach.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@sedona.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Implement ST_Simplify() [sedona-db]

Posted by "petern48 (via GitHub)" <gi...@apache.org>.
petern48 commented on issue #244:
URL: https://github.com/apache/sedona-db/issues/244#issuecomment-3515299137

   > noticed that the PostGIS has different behavior for collapsed geometries and collection types
   
   @joonaspessi Do you happen to still remember some specific test cases that demonstrate these differences? @Abeeujah has kindly taken up this task and is interested in some test cases to help guide the custom implementation.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@sedona.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Implement ST_Simplify() [sedona-db]

Posted by "paleolimbot (via GitHub)" <gi...@apache.org>.
paleolimbot commented on issue #244:
URL: https://github.com/apache/sedona-db/issues/244#issuecomment-3518423799

   > noticed that the PostGIS has different behavior for collapsed geometries and collection types
   
   I took a closer look at the implementation and I think that it is mostly a performance boost rather than changed behaviour. If or when we implement this in Rust we can do something similar...in the meantime we should definitely wire up the rust version!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@sedona.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Implement ST_Simplify() [sedona-db]

Posted by "Abeeujah (via GitHub)" <gi...@apache.org>.
Abeeujah commented on issue #244:
URL: https://github.com/apache/sedona-db/issues/244#issuecomment-3517670134

   This seems to revert the issue with the type change after Simplify
   ```rust
       let geometry = match (initial_type, geometry.geometry_type()) {
           (GeometryTypes::MultiPolygon, GeometryTypes::Polygon) => {
               Geometry::create_multipolygon(vec![geometry]).map_err(|e| {
                   DataFusionError::Execution(format!("Failed to revert geometry promotion: {e}"))
               })?
           }
           (GeometryTypes::MultiLineString, GeometryTypes::LineString) => {
               Geometry::create_multiline_string(vec![geometry]).map_err(|e| {
                   DataFusionError::Execution(format!("Failed to revert geometry promotion: {e}"))
               })?
           }
           _ => geometry,
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@sedona.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Implement ST_Simplify() [sedona-db]

Posted by "paleolimbot (via GitHub)" <gi...@apache.org>.
paleolimbot closed issue #244: Implement ST_Simplify()
URL: https://github.com/apache/sedona-db/issues/244


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@sedona.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org