[Dachs-support] s_regions compound regions
Markus Demleitner
msdemlei at ari.uni-heidelberg.de
Thu Feb 24 15:27:17 CET 2022
Dear Chloé,
On Thu, Feb 24, 2022 at 02:00:00PM +0100, Chloé Azria wrote:
> I have a question about s_region on DaCHS : does DaCHS handles Compounds
> Regions?
>
> For Example I try an union of two simple 3-points polygons:
>
> 'Union ICRS TOPOCENTER (Polygon 180.0 45.0 230.0 80.0 300.0 30.0 180.0 45.0
> Polygon 180.0 45.0 50.0 80.0 60.0 30.0 180.0 45.0)'
>
>
> and I cannot import, it raises the error :
>
>
> Done /var/gavo/inputs/hfc1ar/data/driver.txt, read 1
> *** Error: The database engine reported:
>
> (Nothing)
I can't quite say why it reports nothing; the correct message would
be something like "You cannot put a union of polygons into a
polygon-valued column", and, really, it would be up to DaCHS to
produce this.
There is no simple workaround, since pgsphere -- which in the end has
to manage the geometries -- does not know about multipolygons.
Depending on what you are trying to do, I'd say you should look at
changing the s_region column to the type smoc and then turn
your geometries into MOCs. That's fairly experimental, but
as long as users aren't *reading* the s_region in a table browser,
they probably won't notice. It could also do with better
documentation (cf. <https://blog.g-vo.org/crazy-shapes-in-tap.html>,
though).
I just notice that pgsphere.SMoc doesn't expose MOC joins yet, but
you can probably fudge it by doing something like
m1 = pgsphere.SPoly([180.0, 45.0, 230.0, 80.0, 300.0, 30.0, 180.0,
45.0]).asSMoc()
m2 = pgsphere.SPoly([180.0, 45.0, 230.0, 80.0, 300.0, 30.0, 180.0, 45.0]
45.0]).asSMoc()
union = pgsphere.SMoc.fromASCII(m1.asASCII()+" "+m2.asASCII())
-- or grab m1.moc, which is a pymoc.MOC instance and probably will
keep being that for the time being, and that ought to have union and
intersection exposed.
A bit in a hurry,
Markus
More information about the Dachs-support
mailing list