Created
September 16, 2020 20:25
-
-
Save Geobuddy/e15fc2a050c339c5ebae625ff31b4c20 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 myPop = population; | |
| var myCrime = crime.features; | |
| var myBoundary = boundaries.features; | |
| for(var i =0; i < myCrime.length; i++){ | |
| var dataState = myCrime[i].properties.community_area; | |
| var dataValue = +myCrime[i].properties.offence; | |
| for(var k= 0; k < myPop.length; k++){ | |
| var popArea = myPop[k].Community_Area_Num; | |
| var popNum = +myPop[k].Population_2010; | |
| for(var j =0; j < myBoundary.length; j++){ | |
| var jsonState = myBoundary[j].properties.area_numbe; | |
| if(dataState == jsonState){ | |
| myBoundary[j].properties.value = dataValue; | |
| break; | |
| } | |
| if(popArea == jsonState){ | |
| myBoundary[j].properties.population_numb = popNum; | |
| var count = myBoundary[j].properties.value; | |
| var pop = myBoundary[j].properties.population_numb | |
| myBoundary[j].properties.crime_rate = (count / pop )*1000; | |
| break; | |
| } | |
| } | |
| } | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment