Last active
August 29, 2015 14:06
-
-
Save boo1ean/7517e7b3dc55b21bacb4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var pollutants = []; | |
var findPollutant = function(point) { | |
for (var i in pollutants) { | |
if (pollutants[i].latitude == point[1] && pollutants[i].longitude == point[0]) { | |
return i; | |
} | |
} | |
return -1; | |
} | |
for (var i in waterbodies) { | |
var wb = waterbodies[i]; | |
var points = waterbodies[i].points; | |
if (points && points.length) { | |
for (var j in points) { | |
var index = findPollutant(points[j]); | |
if (index === -1) { | |
pollutants.push({ | |
latitude: points[j][1], | |
longitude: points[j][0], | |
causes: [wb.LW_DETAILED_CAUSE_NAME], | |
waterbody: wb.LISTED_WATER_NAME | |
}); | |
} else { | |
pollutants[index].causes.push(wb.LW_DETAILED_CAUSE_NAME); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment