Aggregate functions for TopoGeometries

Felipe Matas felipematas at yahoo.com
Wed Nov 13 07:42:39 PST 2024


 Well, it is linked with other aspects, maybe the two more important I see are:
Learning curve: To create a new layer and populate it well, you need to understand TopoGeometry, Layers, TopoElements and maybe Components, be able to do something like:
    INSERT INTO states (name, tgeom)
    SELECT state_name, CreateTopoGeom(
      'mytopo',
      3, -- areal
      layer_id(findLayer('states', 'tgeom'))
      TopoGeometryArray_agg(tg)
    )
    FROM counties
    GROUP BY state_name;
Simplifies a lot the understanding of it.
This also helps to know if we are doing it wrong, knowing the TopoGeometries we are going to use as child, we can verify they are actually childs of that layer, and stop the query, we can't do that with TopoElements, this also helps when we are trying to use or start using Topology.
Probs using something like this would impact on performance, the check and some internal conversions, still the code would need to transform to TopoElements, I think in the other hand, if this has not a big impact, would be useful to have nicer code knowing what we are doing is right, we can always make mistakes, and this is something we can handle.
Thx!
   El miércoles, 13 de noviembre de 2024, 11:56:55 a. m. GMT-3, Sandro Santilli <strk at kbt.io> escribió:  
 
 On Wed, Nov 13, 2024 at 12:44:26PM +0000, Felipe Matas wrote:

> I still I think would be nicer to work directly with TopoGeometries
> than TopoElements in this cases, is also more intuitive, there is a lot
> of advantages to use them :)

Concrete proposals are welcome, with example queries.

Right now you would do something like this:

    INSERT INTO states (name, tgeom)
    SELECT state_name, CreateTopoGeom(
      'mytopo',
      3, -- areal
      layer_id(findLayer('states', 'tgeom'))
      TopoElementArray_agg(tg::TopoElement)
    )
    FROM counties
    GROUP BY state_name;

How would you make it more intuitive ?

--strk;
  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20241113/68c1a5e3/attachment.htm>


More information about the postgis-devel mailing list