{"action":"opened","issue":{"url":"https://api.github.com/repos/OpenTreeMap/otm-core/issues/2067","labels_url":"https://api.github.com/repos/OpenTreeMap/otm-core/issues/2067/labels{/name}","comments_url":"https://api.github.com/repos/OpenTreeMap/otm-core/issues/2067/comments","events_url":"https://api.github.com/repos/OpenTreeMap/otm-core/issues/2067/events","html_url":"https://github.com/OpenTreeMap/otm-core/issues/2067","id":88826736,"number":2067,"title":"Make `MapFeature` geometry-agnostic","user":{"login":"RickMohr","id":2162993,"avatar_url":"https://avatars.githubusercontent.com/u/2162993?v=3","gravatar_id":"","url":"https://api.github.com/users/RickMohr","html_url":"https://github.com/RickMohr","followers_url":"https://api.github.com/users/RickMohr/followers","following_url":"https://api.github.com/users/RickMohr/following{/other_user}","gists_url":"https://api.github.com/users/RickMohr/gists{/gist_id}","starred_url":"https://api.github.com/users/RickMohr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RickMohr/subscriptions","organizations_url":"https://api.github.com/users/RickMohr/orgs","repos_url":"https://api.github.com/users/RickMohr/repos","events_url":"https://api.github.com/users/RickMohr/events{/privacy}","received_events_url":"https://api.github.com/users/RickMohr/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-06-16T20:02:59Z","updated_at":"2015-06-16T20:02:59Z","closed_at":null,"body":"Here's our current class hierarchy:\r\n\r\n```\r\nMapFeature (containing point field)\r\n    Plot\r\n    PolygonalMapFeature (containing polygon field)\r\n        Bioswale\r\n```\r\n\r\nThis has (at least) two problems:\r\n1) `Bioswale` has a point field which it doesn't want\r\n2) When the tiler renders map feature markers it always includes bioswales, even when bioswale polygons are also being rendered in another layer\r\n\r\nPossible solutions to #2 include:\r\n* In tiler SQL for rendering markers, exclude map features with polygons\r\n* In tiler SQL for rendering markers, exclude map features whose type is not in `('Bioswale', 'RainGarden', ...)`\r\n\r\nI 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.\r\n\r\nI propose instead introducing a `PointMapFeature` class, making `MapFeature` geometry-agnostic:\r\n\r\n```\r\nMapFeature\r\n    PointMapFeature (containing point field)\r\n        Plot\r\n    PolygonalMapFeature (containing polygon field)\r\n        Bioswale\r\n```\r\n\r\nAdvantages:\r\n* `MapFeature` is geometry-agnostic; point features are no longer special\r\n* Don't have to solve #1\r\n* Straightforward solution to #2:\r\n  * In tiler SQL for rendering markers, inner join to `treemap_pointmapfeature`\r\n  * In carto CSS for polygonal map features, render a marker instead of a polygon below zoom 15\r\n\r\nThis would require a schema+data migration similar to [this one](https://github.com/OpenTreeMap/otm-core/blob/master/opentreemap/treemap/migrations/0055_auto__del_importevent__add_mapfeature__del_field_tree_import_event__de.py) but a bit more involved.\r\n\r\n"}}