pedrogit/postgisaddons

ST_SplitAgg example

Opened this issue · 2 comments

Hello! Thank you @pedrogit for this awesome collection of PostGIS enhancements. I have a use case for ST_SplitAgg and am excited to use it.

When I ran the first example for ST_SplitAgg I got this error:

ERROR:  column reference "geom" is ambiguous
LINE 10:  SELECT DISTINCT ON (ST_AsEWKB(geom)) unnest(ST_SplitAgg(a.g...

I replaced geom with a.geom and that seems to have resolved it. If it's helpful, I'm on Postgres 15.2.

I can do a PR to update the example. I have a few other questions about how ST_SplitAgg works and might keep adding to this thread, if that's OK.

Is there a reason the example does GROUP BY ST_AsEWKB(a.geom) and not GROUP BY a.geom? I'm working with a very large polygon layer and just thinking of some optimizations...!

When I make this change to the example, I'm getting what I believe are the same geoms and the same number of rows. I'm wondering if there are any other side effects I'm not thinking of, though 🤔

I guess, at the time, the == operator on geom, which is used by GROUP BY, did not make equivalent polygons (having the same footprint but having vextexes not in the same order) equals . I think it might have been fixed in PostGIS at some point. I think I wrote to postgis-user about this at some point.

I fixed the example.