Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. ###############################################################################
  2. # 5. Assign Each Segment a Color Based on its Length #
  3. ###############################################################################
  4. # List to store colors
  5. roadColors = []
  6.  
  7. # The length is in meters
  8. for item in data:
  9. if "length" in item.keys():
  10.  
  11. if item["length"] <= 100:
  12. color = "#d40a47"
  13.  
  14. elif item["length"] > 100 and item["length"] <= 200:
  15. color = "#e78119"
  16.  
  17. elif item["length"] > 200 and item["length"] <= 400:
  18. color = "#30bab0"
  19.  
  20. elif item["length"] > 400 and item["length"] <= 800:
  21. color = "#bbbbbb"
  22.  
  23. else:
  24. color = "w"
  25.  
  26. roadColors.append(color)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement