Skip to content

Commit

Permalink
more fixes for issue #310
Browse files Browse the repository at this point in the history
  • Loading branch information
gloriajjl committed Feb 15, 2020
1 parent 70dd0a9 commit 693445d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
4 changes: 4 additions & 0 deletions backend/promis/backend_api/serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,10 @@ def gen_selection():
# Intersection of search polygon and the orbit
isect = obj.session.geo_line.intersection(poly)

#django docs say that GEOSGeometry.dims returns -1 for empty GeometryCollection
if isect.dims == -1:
return

# Making sure isect is a collection of geolines, not a single one
if type(isect) is not MultiLineString:
isect = [ isect ]
Expand Down
11 changes: 10 additions & 1 deletion frontend/app/constants/Selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,20 @@ export function selectionToPolygon(selection) {
case Types.Rect:
let bounds = Leaflet.latLngBounds(selection.data[0], selection.data[1]);
//let center = bounds.getCenter();

points.push(bounds.getSouthWest());
points.push(bounds.getSouthEast());
// had to add these two intermidiate points to overcome the bug
// "Antipodal (180 degrees long) edge detected!"
if (selection.data[0][0] == -90 && selection.data[1][0] == 90)
{
points.push({lat: 0, lng: bounds.getSouthEast().lng})
}
points.push(bounds.getNorthEast());
points.push(bounds.getNorthWest());
if (selection.data[0][0] == -90 && selection.data[1][0] == 90)
{
points.push({lat: 0, lng: bounds.getNorthWest().lng})
}
break;

case Types.Circle:
Expand Down

0 comments on commit 693445d

Please sign in to comment.