# Arrays of geometries?

Dave Morris dave.morris at metagrid.co.uk
Fri Sep 15 17:49:51 CEST 2017

```Hi DAL,

Are POLYGONs arrays of POINTs ?

The current email thread is considering this:

<!-- Four points, each made up of two floats -->
<FIELD datatype="float" arraysize="2x4" xtype="point"...>

to mean an array of four POINTs. Where the arraysize is split, with the
first number, 2, applied to the 'float' part and the 4 applied to the
'point' part.

What does that mean for POLYGONs ?

At the moment POLYGONs are handled as 1D arrays of floats:

<!-- A single polygon made up from 8 floats -->
<FIELD datatype="float" arraysize="8" xtype="polygon"...>

where the first part of the arraysize, 8, applies to the 'float' part
and the 'polygon' part is unmodified.

Are these equivalent ?

<!-- Four points, each made up of two floats -->
<FIELD datatype="float" arraysize="2x4" xtype="point"...>

<!-- A single polygon made up from 8 floats -->
<FIELD datatype="float" arraysize="8" xtype="polygon"...>

What happens if we push the model to handle multiple shapes ?

<!-- A single polygon made up from 8 floats -->
<FIELD datatype="float" arraysize="8" xtype="polygon"...>

<!-- Three polygons, each made up from eight floats -->
<FIELD datatype="float" arraysize="8x3"   xtype="polygon"...>

<!-- Four points, each made up of two floats -->
<FIELD datatype="float" arraysize="2x4" xtype="point"...>

<!-- Three shapes, each made up of four points, each made of two
floats -->
<FIELD datatype="float" arraysize="2x4x3" xtype="point"...>

I *think* this works.

If we serialize polygons as arrays of points, do we need the polygon
xtype?

It might help avoid the ambiguity caused by an incomplete polygon:

<!-- An incomplete polygon made up from 3 floats -->
<FIELD datatype="float" arraysize="3" xtype="polygon"...>

Any thoughts ?

-- Dave

--------
Dave Morris
Research Software Engineer
Wide Field Astronomy Unit
Institute for Astronomy
University of Edinburgh
--------

On 2017-09-05 12:24, Markus Demleitner wrote:
> Dear DAL,
>
> While implementing DALI 1.1 with a view to TAP 1.1, one of my test
> cases lead to the encoding of a 2-array of points to a
>
> <FIELD datatype="float" arraysize="2x2" xtype="point"...>
>
> This made me realise that, as far as I can see, it's unclear what
> that means by DALI.  And it leads to the more fundamental question of
> whether xtype amends the datatype -- which would support such usage
> -- or whether it amends (datatype, arraysize) -- which probably would
> outlaw things like these.
>
> So:
>
> Is anyone strongly in favour of such usage?  Note that another,
> perhaps more common, use case is arrays of timestamps, which *could*
> play a role in certain time series serialisations?
>
> ...or is anyone strongly opposed to it?
>
> Either way, I think it's one of these corner cases where we should
> somehow agree upon a policy.  Should xtype+array be allowed?
> Forbidden?  Undefined at this point?
>
>           -- markus
```