adhocracy3 icon indicating copy to clipboard operation
adhocracy3 copied to clipboard

Use MultiPolygons in frontend

Open nidico opened this issue 10 years ago • 3 comments

Our backend stores locations as multipolygons. However our frontend code (e.g. Mapping.ts) always deals with simple polygons without holes (i.e. two array levels less). This should be aligned to MultiPolygons.

nidico avatar May 08 '15 13:05 nidico

We probably just need to change to leaflet.multipolygons: http://leafletjs.com/reference.html#multipolygon

MagdaN avatar May 11 '15 09:05 MagdaN

I guess that creating a MultiPolygon version of pointInPolygon makes this a bit more complicated.

xi avatar May 11 '15 09:05 xi

Wikipedia has a good overview of geometries in GeoJSON. The short summary is: Polygons can have holes, Multipolygons can contain multiple disjoint polygons.

The leaflet documentation on polygons mentiones that "You can also create a polygon with holes by passing an array of arrays of latlngs, with the first latlngs array representing the exterior ring while the remaining represent the holes inside". There is no such note for Multipolygons, but I guess it applies there as well.

Unfortunately, DefinitelyTyped does not support these optional holes yet.

xi avatar May 11 '15 14:05 xi