Skip to content

Commit

Permalink
add support for python 3.3+
Browse files Browse the repository at this point in the history
  • Loading branch information
bartromgens committed Sep 30, 2017
1 parent 8d4e0f2 commit c727cd7
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions geojsoncontour/contour.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def contour_to_geojson(contour, geojson_filepath, contour_levels, min_angle_deg=
color = collection.get_edgecolor()
for path in paths:
v = path.vertices
if len(v) < 6:
if len(v) < 3:
continue
coordinates = []
v1 = v[1] - v[0]
Expand Down Expand Up @@ -64,16 +64,10 @@ def contour_to_geojson(contour, geojson_filepath, contour_levels, min_angle_deg=
"level-index": contour_index
}
if geojson_properties:
properties = {**properties, **geojson_properties}
properties.update(geojson_properties)
line_features.append(Feature(geometry=line, properties=properties))
contour_index += 1

if total_points_original > 0:
print('total points: ' + str(total_points) + ', compression: ' + str(
int((1.0 - total_points / total_points_original) * 100)) + '%')
else:
print('no points found')

feature_collection = FeatureCollection(line_features)
dump = geojson.dumps(feature_collection, sort_keys=True)
with open(geojson_filepath, 'w') as fileout:
Expand Down

0 comments on commit c727cd7

Please sign in to comment.