Skip to main content

Geometry Collection

Allow multiple geometry types

This geometry type makes it possible to store a mixture of geometry types.

If a design/interface is configured to allow certain geometry types, only one type can be set when populating an item's geometry. However, if the allow list includes the Geometry Collection type, it's possible to set any combination of the other allowed types!

For example, if a design allows the "Point" and "Line" geometry types, you can only set one or the other. But if the "Geometry Collection" type is also allowed, you can set both "Point" and "Line" geometry on an item if you want to.

An item with multiple geometry types displayed on the map
Note

If Geometry Collection is the only allowed type, it won't be possible to populate items with any geometry!

How to draw

When editing item geometry (or any other geometry field in Alloy), the Geometry Editor appears. The row of draw tools indicates which geometry types are allowed by the item's design (or the source of the field).

The draw tools are dimmed out if the relevant geometry type isn't allowed

Use the tools to draw your desired geometry. To learn how, see:

If a tool appears dimmed, no additional geometry of that type can be added.

Example GeoJSON

To access the underlying code of the current geometry, select Menu in the Geometry Editor and choose GeoJson view.

{
"type": "GeometryCollection",
"geometries": [
{
"type": "MultiPoint",
"coordinates": [
[-1.51123, 52.279158],
[-1.511222, 52.279371],
[-1.510856, 52.279194]
]
},
{
"type": "LineString",
"coordinates": [
[-1.511289, 52.279448],
[-1.510952, 52.279445],
[-1.510783, 52.279233]
]
},
{
"type": "MultiPolygon",
"coordinates": [
[
[
[-1.511178, 52.279337],
[-1.511074, 52.27936],
[-1.511033, 52.279289],
[-1.510985, 52.2793],
[-1.510935, 52.279218],
[-1.511114, 52.279177],
[-1.51117, 52.279274],
[-1.511143, 52.279279],
[-1.511178, 52.279337]
]
],
[
[
[-1.510832, 52.27942],
[-1.510756, 52.27944],
[-1.510643, 52.279273],
[-1.51072, 52.279254],
[-1.510832, 52.27942]
]
]
]
}
]
}