How to select a single geometry inside a GeometryCollection

7 views
Skip to first unread message

matteo.velludi...@gmail.com

unread,
Mar 20, 2018, 7:03:49 AM3/20/18
to OpenLayers Dev
Hi,

I'm Matteo a gis developer,
after a while searching on your documentation / github / stackoverflow i come to you :)
I have a list of questions for you.

I have a Feature like this: 
{
    type: "GeometryCollection",
    geometry: {
        geometries: [
            {
                type: "MultiPolygon",      <----   i want this or
                coordinates: [ polygon1, polygon2 ]  <------ i want polygon1 if user has clicked on it
            }, {
                type: "MultiLineString",
                coordinates: [...]
            }, {
                type: "MultiPoint",
                coordinates: [...]
            },
        ]
    }
}

is there a way to retrieve the geometry selected by the user instead of the whole feature the ol.interaction.Select returns?

if yes, in case of MultiGeometries is there a way to get the internal polygon/line/point selected? (if not I can try to avoid the use of multigeom)

probably this can lead to another problem, what if the point clicked by the user is inside the intersection of two or more geometries, i.e. 2 polygons, 1 polygon and 1 line? (in that case i could chose the geom based on the z-index)


if you need more details, please ask.

Cheers.

Reply all
Reply to author
Forward
0 new messages