Check for empty coordinates when we transform to polygon

This commit is contained in:
Mario de Frutos 2018-02-02 13:18:32 +01:00
parent a1f339376e
commit c5fed2cc80

View File

@ -45,6 +45,8 @@ def marshall_coordinates(coordinates):
def coordinates_to_polygon(coordinates): def coordinates_to_polygon(coordinates):
"""Convert a Coordinate array coordinates to a PostGIS polygon""" """Convert a Coordinate array coordinates to a PostGIS polygon"""
if not coordinates:
return None
coordinates.append(coordinates[0]) # Close the ring coordinates.append(coordinates[0]) # Close the ring
result_coordinates = [] result_coordinates = []
for coordinate in coordinates: for coordinate in coordinates: