Ticket #375 (closed enhancement: fixed)

Opened 5 years ago

Last modified 2 years ago

Add lwcollection_homogenize and ST_Homogenize

Reported by: colivier Owned by: pramsey
Priority: medium Milestone: PostGIS 2.0.0
Component: postgis Version:
Keywords: homogenize collection ST_GeomFromKML Cc:

Description

/*
** Given a generic collection, return the "simplest" form.
**
** eg: GEOMETRYCOLLECTION(MULTILINESTRING()) => MULTELINESTRING()
**     GEOMETRYCOLLECTION(MULTILINESTRING(), MULTILINESTRING(), POINT())
**      => GEOMETRYCOLLECTION(MULTILINESTRING(), MULTIPOINT())
**
** In general, if the subcomponents are homogeneous, return a properly
** typed collection.
** Otherwise, return a generic collection, with the subtypes in minimal
** typed collections.

I need this stuff for ST_GeomFromKML, to be able to return simplest geometry forms if KML input is mixed.

Change History

  Changed 4 years ago by colivier

Synopsys become:

/*
** Given a generic geometry, return the "simplest" form.
**
** eg: 
**     LINESTRING() => LINESTRING()
**
**     MULTILINESTRING(with a single line) => LINESTRING()
**
**     GEOMETRYCOLLECTION(MULTILINESTRING()) => MULTILINESTRING()
**
**     GEOMETRYCOLLECTION(MULTILINESTRING(), MULTILINESTRING(), POINT())
**      => GEOMETRYCOLLECTION(MULTILINESTRING(), POINT())
*/

Commited in lwgeom as r5265 and r5266

Do you think is worth to be exposed as SQL function also ? And if yes ST_Homogenize is a good name choice ?

  Changed 4 years ago by colivier

  • status changed from new to closed
  • resolution set to fixed

If no one react, i guess that it doesn't worth that much to expose to SQL this function. ;)

I close the ticket.

  Changed 3 years ago by pramsey

  • status changed from closed to reopened
  • resolution fixed deleted

  Changed 3 years ago by pramsey

  • owner changed from colivier to pramsey
  • status changed from reopened to new

  Changed 3 years ago by strk

Reacting, as I like this function :) Olivier: still interested in bringing it in ?

  Changed 3 years ago by colivier

Sandro,

Core function is already in. just need to expose it trought PostGIS API.

Can took it, with an help on the related documentation.

  Changed 3 years ago by robe

Olivier,

If you provide PostGIS API I'll help you document it.

  Changed 2 years ago by pramsey

OK, I've updated the internal function to handle more types, now to do the SQL binding.

  Changed 2 years ago by pramsey

And the function is committed to trunk at r9009

  Changed 2 years ago by pramsey

  • status changed from new to closed
  • resolution set to fixed

Docs committed at r9010

follow-up: ↓ 13   Changed 2 years ago by strk

Why did this one end up being called ST_CollectionHomogenize rather than just ST_Homogenize ? It also homogenizes MULTI*, not just collection. Are we in time to rename before going final or should we live with the current name forever ?

  Changed 2 years ago by strk

Beside, documentation is also wrong: "Collections that are homogeneous will be returned as the appropriate multi-type", while instead a GEOMETRYCOLLECTION composed by a single element is returned as a point, not a multi-point. Or maybe that's what "singleton" was about..

in reply to: ↑ 11   Changed 2 years ago by pramsey

Replying to strk:

Why did this one end up being called ST_CollectionHomogenize rather than just ST_Homogenize ? It also homogenizes MULTI*, not just collection.

It puts it next to ST_CollectionExtract it's similar-but-different functional cousin.

Note: See TracTickets for help on using tickets.