[GIS] OpenLayers 3 – different style/marker for each point on a MultiPoint feature

geojsonmultipointopenlayers

I have a MultiPoint feature with the following GeoJSON:

{
    "type": "Feature",
    "geometry": {
        "type": "MultiPoint",
        "coordinates": [
            [
                -123,
                58
            ],
            [
                -152.32,
                17.5
            ],
            [
                52.02,
                42.64
            ]
        ]
    }
}

When I draw this on map and apply any icon through a style function, its applied for all points. But I would like to show all the three coordinates above with different icons on map. Is there any way I can add different markers for each coordinates in a Multipoint feature?

Best Answer

I think you have a conceptual problem - if your three coordinate pairs do not represent the same thing, then you don't really have MultiPoint. MultiPoint is three locations that are intrinsically the same feature. Not different instances of the same kind of feature, but really just one feature that needs three locations to represent it.

If you need to style it differently, break it up using getPoints(), copy whatever attributes really should be common, and style / handle each point separately.