Skip to content

Whole layer transparency or OMPoly-with-holes #59

@ianrenton

Description

@ianrenton

Hi,

I have a data set consisting of lat/lon polygons of varying "priority", say on a scale of green to red. These polys overlap, so for example a yellow poly might overlap one or more green polys, and a red poly might overlap several green & yellow polys, etc.

With zero transparency, this is not a problem - I can just generate OMPolys in "priority" order, letting them overlap however they want. However, I would like to make the overall effect semi-transparent. Unfortunately in OpenMap, setting the transparency of a layer actually sets the transparency of all graphics on it individually. This ends up changing the overall effect, for example, a red polygon that overlaps a green polygon is no longer "pure" red but a combination of colours.

I have thought of two ways of resolving this:

  1. Rendering all the polygons to a single buffered image, then projecting the image onto the layer - there is therefore only one graphic on the layer so the transparency is applied to the whole thing
  2. Creating an "OMPoly with holes" so that I can remove areas from "green" polys that are underneath "red" polys (and so on), so that any given lat/lon point, is only inside one shape.

I have started to play around with both approaches but neither of them seems particularly easy, so before I get too much further into it... does OpenMap already support a way of doing this? If not, has anyone done anything similar and who may be able to share tips on what the best approach is?

OpenMap 5.1.15.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions