weird New Zeland polygons
So I have been using this for several years without any problems, and recently I have had issue with polygons drawn over NZ in that the multi_polygon.contains should come back as true but are not.
I looked at the map and I noticed there were two New Zealands if I zoomed out far enough, and more if I scrolled horizontally. So when I drew some squares over all the different NZ's and when inspected the resulting polygons gave some weird numbers back:
example good poly (Pdb) self.cleaned_data['zone_polygon'].geojson u'{ "type": "MultiPolygon", "coordinates": [ [ [ [ 161.3671875, -49.610709938074216 ], [ 161.3671875, -32.54681317351514 ], [ 182.109375, -32.54681317351514 ], [ 182.109375, -49.610709938074216 ], [ 161.3671875, -49.610709938074216 ] ] ] ] }'
below are bad polygon examples
(Pdb) self.cleaned_data['zone_polygon'].geojson u'{ "type": "MultiPolygon", "coordinates": [ [ [ [ -918.984375, -50.06419173665909 ], [ -918.984375, -35.746512259918497 ], [ -841.9921875, -35.746512259918497 ], [ -841.9921875, -50.06419173665909 ], [ -918.984375, -50.06419173665909 ] ] ] ] }'
(Pdb) self.cleaned_data['zone_polygon'].geojson u'{ "type": "MultiPolygon", "coordinates": [ [ [ [ -196.171875, -47.754097979680019 ], [ -196.171875, -34.307143856288029 ], [ -177.1875, -34.307143856288029 ], [ -177.1875, -47.754097979680019 ], [ -196.171875, -47.754097979680019 ] ] ] ] }'
i checked the version that i'm using: django-leaflet==0.18.1
was this been addressed in an update? is there some easy geo-math to fix this?
You shouldn't have longitude below -180 or above 180. How did you create those polygons ?
there's multiple new zealands on the map
Take a look at https://github.com/Leaflet/Leaflet/issues/1885