OpenTreeMap / otm-core

OpenTreeMap is a collaborative platform for crowdsourced tree inventory, ecosystem services calculations, urban forestry analysis, and community engagement.
www.opentreemap.org
Other
190 stars 87 forks source link

Make `MapFeature` geometry-agnostic #2067

Closed RickMohr closed 9 years ago

RickMohr commented 9 years ago

Here's our current class hierarchy:

MapFeature (containing point field)
    Plot
    PolygonalMapFeature (containing polygon field)
        Bioswale

This has (at least) two problems: 1) Bioswale has a point field which it doesn't want 2) When the tiler renders map feature markers it always includes bioswales, even when bioswale polygons are also being rendered in another layer

Possible solutions to #2 include:

I don't like those solutions because the code for rendering markers has to consider everything that isn't a marker, which is fragile over the long-term.

I propose instead introducing a PointMapFeature class, making MapFeature geometry-agnostic:

MapFeature
    PointMapFeature (containing point field)
        Plot
    PolygonalMapFeature (containing polygon field)
        Bioswale

Advantages:

This would require a schema+data migration similar to this one but a bit more involved.

maurizi commented 9 years ago

-1.

The point feature on the bioswale model has proved useful in implementing advanced search, and I suspect will be useful in the future.

In terms of solving problem # 2 outlined above, I think the that their long-term fragility is not very significant, since I doubt we will accumulate a significant number of kinds of polygonal map features.