This repository demos Pentaho's ability to utilize ESRI shapefile data by providing a step-by-step guide and example code for a Chicago Crime Heat Map.
To do this, we use the CTools' Dashboard component, NewMapComponent. NewMapComponent takes either GeoJSON or KML files as input, so as an additional first step we use PDI & open-source tools to convert the ESRI shapefile into GeoJSON.
This guide uses the following software:
- Pentaho Server 8.0
- Pentaho Data Integration 8.0
- GDAL 2.2.1
And the following data from Chicago Data Portal:
- Community Areas Shapefile https://data.cityofchicago.org/Facilities-Geographic-Boundaries/Boundaries-Community-Areas-current-/cauq-8yn6
- Chicago Crime Data https://data.cityofchicago.org/Public-Safety/Crimes-2001-to-present/ijzp-q8t2
The shapefile is already downloaded and unzipped to the /resources/esri
directory.
Please see the following links for installation instructions:
- Archive Installation of the Pentaho Server
- Install PDI Tools and Plugins
- Installing GDAL for Windows
There's more than 1 way to convert ESRI to GeoJSON, but here we use the GDAL
suite's ogr2ogr
command line tool. If you
have a large volume of shapefile data, you may want to look at alternative
conversion tools appropriate for your environment.
A brief example of using ogr2ogr
to convert ESRI to GeoJSON can be found on
GitHub.
The PDI transformation ESRI-to-GeoJSON.ktr
takes as parameters the path to the
source shapefile and target geojson. By default these point to the included
files in the /resources
directories.
The transformation simply calls the ogr2ogr
command with the proper inputs and
options, and the GDAL libraries handle the conversion.
In order to run, you'll need to unzip the neighborhoods data in
/resources/esri
first.
After running, you can inspect the resulting GeoJSON file.
{
"type": "FeatureCollection",
"name": "geo_export_80095076-0a6b-4028-a365-64ec9f0350d7",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
"features": [
{ "type": "Feature", "properties": { "perimeter": 0.0, "community": "DOUGLAS", "shape_len": 31027.0545098, "shape_area": 46004621.158100002, "area": 0.0, "comarea": 0.0, "area_numbe": "35", "area_num_1": "35", "comarea_id": 0.0 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -87.609140876178913, 41.84469250265397 ], [ -87.609148747578061, 41.844661598424025 ], [ -87.609161120412566, 41.844589611939533 ], [ -87.60916766215837, 41.844517177323148 ], [ -87.609168606001631, 41.844456260738298 ], [ -87.609150121993963, 41.844238716598099 ], [ -87.609072412492878, 41.844194738881008 ], [ -87.609006271478194, 41.844106469286956 ], [ -87.608965021721573, 41.844043457551145 ], [ -87.608915663906131, 41.843955293750533 ], [ -87.608899801189864, 41.843873616495316 ], [ -87.608867013718609, 41.843804382800464 ], [ -87.608851434244883, 41.843697606960852 ], [ -87.608810892810908, 41.843571847766405 ], [ -87.608771272227841, 41.843364517153525 ], [ -87.608721560825273, 41.843307726965172 ], [ -87.608672203896774, 41.843219563055783 ], [ -87.608581527890138, 41.843074662101174 ], [ -87.608473856828695, 41.842948479158864 ], [ -87.608391359901532, 41.84282245528464 ], [ -87.608267402956429, 41.842652243366018 ], [ -87.608176728283681, 41.842507342088794 ], [ -87.608069130184205, 41.842374884194875 ], [ -87.608019561893769, 41.842305544003324 ], [ -87.608020979190101, 41.842180049740598 ], [ -87.607998143968814, 41.841972824540612 ], [ -87.60797502577401, 41.841790698735288 ], [ -87.607976655736223, 41.841646380184173 ], [ -87.607978143955407, 41.841514610782717 ], [ -87.607979490428235, 41.84139539108061 ], [ -87.607947343375457, 41.841269684549609 ], [ -87.607890164768889, 41.84113126985843 ], [ -87.607849343257314, 41.841030609153378 ], [ -87.6077334988166, 41.840885548504232 ], [ -87.607656304333418, 41.840761937932839 ], [ -87.607575831272683, 41.840638219323175 ], [ -87.607527605028679, 41.840560307726882 ], [ -87.60698398203985, 41.840667385242391 ], [ -87.606678164252841, 41.840561372588027 ], [ -87.606713615148593, 41.84050343556909 ], [ -87.606994976547711, 41.840600109806395 ], [ -87.607500904329484, 41.840502844881108 ], [ -87.607461179262401, 41.840459949950414 ], [ -87.607442203513287, 41.840418504760294 ], [ -87.607433270422746, 41.840393959622688 ], [ -87.607436617128926, 41.840369491544998 ], [ -87.607439288991458, 41.840365281721709 ], [ -87.607450162506098, 41.8403481494191 ], [ -87.607413197705213, 41.840268557555525 ], [ -87.607347914052482, 41.84010499069629 ], [ -87.607210919624933, 41.839651627989788 ], [ -87.607095230072332, 41.839512036959185 ], [ -87.607004846332771, 41.839456579941206 ], [ -87.606941313975668, 41.839428186974999 ], [ -87.606903356043873, 41.839409835064373 ], [ -87.606828174153605, 41.839373135024772 ], [ -87.606761040026655, 41.83933868152846 ], [ -87.606701265041181, 41.839302628268129 ], [ -87.606661945018473, 41.839274936625273 ], [ -87.606620473377646, 41.839242840812702 ], [ -87.606584113115503, 41.839212972735666 ], [ -87.606512234002366, 41.839143911110419 ], [ -87.606492281131395, 41.839124496260304 ], [ -87.606467950042642, 41.839100821226083 ], [ -87.606451250935251, 41.83908479828429 ], [ -87.606156278396085, 41.838635021124837 ], [ -87.606140489649192, 41.838638569383249 ], [ -87.604709844857751, 41.838960060651331 ], [ -87.604277730138932, 41.839582138973583 ], [ -87.604274947009301, 41.839827327002233 ], [ -87.6041850632229, 41.839828572849811 ], [ -87.604195462748663, 41.839554371732262 ], [ -87.604667034870289, 41.838879870158486 ], [ -87.606134988799383, 41.838551275839208 ], [ -87.606135940900046, 41.838521050813988 ], [ -87.606129051106365, 41.83843916811513 ], [ -87.606115006484401, 41.838298783785824 ], [ -87.606100962286462, 41.838158399454194 ], [ -87.60607903537435, 41.838023811031199 ], [ -87.606104535951744, 41.837842757122232 ], [ -87.606098903651969, 41.837649815256171 ], [ -87.606085454861173, 41.837456823617309 ], [ -87.606071675238539, 41.837293058456872 ], [ -87.606019145675617, 41.83709981933827 ], [ -87.605974895818392, 41.836865713484876 ], [ -87.605914749030234, 41.83665488941115 ], [ -87.605888369371129, 41.836573038288144 ], [ -87.605846786601433, 41.836444015522062 ], [ -87.605770147570439, 41.836309080179483 ], [ -87.605655024449661, 41.836121290178255 ], [ -87.605516188823557, 41.835956732012157 ], [ -87.60530826793098, 41.83568066919603 ], [ -87.605091869897549, 41.835463008601458 ], [ -87.604821026582854, 41.835221619239171 ], [ -87.604642982373534, 41.835068503508566 ], [ -87.604557868519606, 41.834991969650567 ], [ -87.604544292540623, 41.834810668600824 ], [ -87.604734394605927, 41.834589739767935 ], [ -87.605033321631325, 41.834422111788463 ], [ -87.60499603131494, 41.834264042619196 ], [ -87.604943904990733, 41.834035731872078 ], [ -87.60486846410285, 41.833795581844264 ], [ -87.604745598273126, 41.833601896200186 ], [ -87.60463015102502, 41.833443331091168 ], [ -87.604553054252989, 41.833349311682937 ], [ -87.604436878780731, 41.833255043960662 ], [ -87.604351568559096, 41.833196046173519 ], [ -87.604227180007157, 41.833136800267056 ], [ -87.604071528485832, 41.833077355735888 ], [ -87.603915678158813, 41.833035446397624 ], [ -87.603751680524837, 41.833022713423183 ], [ -87.603610997359368, 41.833021819723456 ], [ -87.603486078226226, 41.833009334910493 ], [ -87.603353675629336, 41.83296757380073 ], [ -87.60322922202495, 41.832914171955359 ], [ -87.603128481143557, 41.83283753823148 ], [ -87.603012441590721, 41.832731578817572 ], [ -87.602912299367773, 41.832602337609416 ], [ -87.602796526830673, 41.832472996899924 ], [ -87.602704334280119, 41.83233211495569 ], [ -87.602705397879035, 41.832238591177486 ], [ -87.602730838581891, 41.832063383573448 ], [ -87.602764494153178, 41.831853154321543 ], [ -87.602765424709474, 41.831771321076367 ], [ -87.602735757451313, 41.831630836817965 ], [ -87.602729537685732, 41.831490501422003 ], [ -87.602710203734702, 41.831366246868484 ], [ -87.602797926842499, 41.831366205493239 ], [ -87.602950022590861, 41.831332891682116 ], [ -87.605834941100198, 41.831233947813658 ], [ -87.606049875324686, 41.831232843510591 ], [ -87.606202677695478, 41.831238201487601 ], [ -87.606702092329968, 41.83123285448886 ], [ -87.606867209865982, 41.831232869841749 ], [ -87.607213956677214, 41.831233004219911 ], [ -87.607490359971052, 41.83121711934546 ], [ -87.608286133643006, 41.83120930550497 ], [ -87.609033063552616, 41.831201966033696 ], [ -87.609395739197154, 41.831198400597813 ], [ -87.610633357790604, 41.831186224615493 ], [ -87.611000828387219, 41.829775870528671 ], [ -87.611009777420009, 41.829746837592928 ], [ -87.611020020755461, 41.829716907188086 ], [ -87.611082409379634, 41.829493833966275 ], [ -87.611276446435596, 41.828796693167142 ], [ -87.611276929715785, 41.828794957987171 ], [ -87.611295070443646, 41.828729779351583 ], [ -87.61129609251968, 41.828726102971622 ], [ -87.61133106844251, 41.828600441977891 ], [ -87.61141795484545, 41.828288268551077 ], [ -87.611419409681673, 41.828283040811712 ], [ -87.611483083546446, 41.82805426402367 ], [ -87.611524178901533, 41.827906610717157 ], [ -87.611626684838953, 41.827536259923775 ], [ -87.611689922705736, 41.827307782942448 ], [ -87.611840086685106, 41.826766349392358 ], [ -87.61188696987567, 41.826594073939539 ], [ -87.611948579408661, 41.82636768508938 ], [ -87.612057937228172, 41.825972922946328 ], [ -87.61212792870873, 41.825722741393648 ], [ -87.612255640535736, 41.825262411032931 ], [ -87.612371284660981, 41.824840229927602 ], [ -87.612576951825034, 41.824089387037823 ], [ -87.612624272403224, 41.823890804368254 ], [ -87.61307586546387, 41.823884775478085 ], [ -87.614364035787759, 41.823868987400886 ], [ -87.615147740928634, 41.82385938125492 ], [ -87.615474829182645, 41.823855371507896 ], [ -87.616109227328607, 41.823847591532811 ], [ -87.616732297640795, 41.823838138571737 ], [ -87.616996824758374, 41.823834106843165 ], [ -87.617258545425742, 41.823830117108997 ], [ -87.61770996887725, 41.82382323440644 ], [ -87.617949727298935, 41.823820294808463 ], [ -87.618214359987633, 41.823817049910133 ], [ -87.618551318114754, 41.823812917215015 ], [ -87.618861747048072, 41.823809108918894 ], [ -87.619177605924079, 41.823805229810674 ], [ -87.619988169314254, 41.823795271059446 ], [ -87.620395359382385, 41.823790266119559 ], [ -87.620953323319398, 41.823783405654012 ], [ -87.621601977330982, 41.823775266620771 ], [ -87.622229825868061, 41.823767385357172 ], [ -87.622346365297076, 41.82376591602609 ], [ -87.622407790675737, 41.823765141434173 ], [ -87.62314672394416, 41.823755821869646 ], [ -87.624267760899997, 41.82374167382762 ], [ -87.624321220578807, 41.823741281810115 ], [ -87.624464324603736, 41.823739621387347 ], [ -87.624822710226837, 41.823735732056264 ], [ -87.624972156172163, 41.823734109844771 ], [ -87.625319363946232, 41.823728676357199 ], [ -87.625597946221959, 41.823724849762066 ], [ -87.625743611513357, 41.823723113788859 ], [ -87.625919747771533, 41.823721014522221 ], [ -87.626080028802548, 41.823718735581544 ], [ -87.626422246817924, 41.823713763376432 ], [ -87.626612025602654, 41.82371100550646 ], [ -87.626987088714102, 41.823708098430288 ], [ -87.627224939585574, 41.823704895572604 ], [ -87.627593414369358, 41.82369902364276 ], [ -87.627734486995962, 41.823696775306928 ], [ -87.628069599464837, 41.823690216380768 ], [ -87.628306563090703, 41.823687582131761 ], [ -87.628617930551442, 41.82368504138433 ], [ -87.628765321909455, 41.823683838244619 ], [ -87.628968199713597, 41.823681491629777 ], [ -87.62902443060878, 41.825259347995924 ], [ -87.629031264745208, 41.825453978587063 ], [ -87.629039529490655, 41.825689412593512 ], [ -87.629045597987428, 41.825885582674807 ], [ -87.629092028441832, 41.827330175681389 ], [ -87.629078277240993, 41.827423231543506 ], [ -87.629047679373016, 41.827510064938942 ], [ -87.628988254248483, 41.827582396205322 ], [ -87.628935205441664, 41.827638767462766 ], [ -87.628923129097814, 41.827679390892357 ], [ -87.628932351424197, 41.827855601985853 ], [ -87.628936827137835, 41.82802969804689 ], [ -87.628941622297262, 41.828254949754218 ], [ -87.628946150025897, 41.828481270076857 ], [ -87.628949443294232, 41.828646055801762 ], [ -87.628951357752328, 41.828740048538236 ], [ -87.628953450397759, 41.828842789442788 ], [ -87.628959314851599, 41.829074331772354 ], [ -87.628962323054225, 41.829190319373318 ], [ -87.628965633270795, 41.829317951650509 ], [ -87.628972633229935, 41.829589841644953 ], [ -87.628980341908004, 41.829890770312957 ], [ -87.628987153716807, 41.83015640219859 ], [ -87.628992592124717, 41.830369857146614 ], [ -87.628999411977716, 41.830641389231531 ], [ -87.629003662420743, 41.830832745534217 ], [ -87.628995682995779, 41.830974949479661 ], [ -87.629144947873456, 41.830972862738065 ], [ -87.629244901104229, 41.830971465313581 ], [ -87.629383954276904, 41.830971195211632 ], [ -87.629476785310999, 41.830971014650942 ], [ -87.629530477529158, 41.830970910065815 ], [ -87.629561052802572, 41.830970850700666 ], [ -87.629565511247833, 41.831059627858274 ], [ -87.629583600793438, 41.831753008321385 ], [ -87.62961050449961, 41.832772324761059 ], [ -87.629615607559202, 41.832976461301037 ], [ -87.629621104030349, 41.833209069249811 ], [ -87.629627516624794, 41.833480449935024 ], [ -87.62964438186583, 41.834160101277817 ], [ -87.629644506698014, 41.834164516741097 ], [ -87.62965495205755, 41.834535101177096 ], [ -87.629656896114298, 41.834613593835577 ], [ -87.62965717450092, 41.83462482781529 ], [ -87.629662398195563, 41.834813012893655 ], [ -87.629662769492498, 41.834826384400777 ], [ -87.629687299549104, 41.83581138272185 ], [ -87.6296984548121, 41.836203993016845 ], [ -87.62972206129453, 41.837034850877885 ], [ -87.629738674431607, 41.837568129220848 ], [ -87.629760405123832, 41.838265671733694 ], [ -87.629762667270825, 41.838353031903779 ], [ -87.629782407450193, 41.839099864719202 ], [ -87.62978731526664, 41.839285545769329 ], [ -87.629793125367755, 41.839508895965494 ], [ -87.629800899746073, 41.839804294512696 ], [ -87.62981523196882, 41.840338484535131 ], [ -87.629829446396414, 41.840863979141943 ], [ -87.629842005862969, 41.841328297547982 ], [ -87.629857507471627, 41.841713961185995 ], [ -87.629860992782241, 41.841835078814036 ], [ -87.629863097170471, 41.841908213085929 ], [ -87.629866196087562, 41.842015892441744 ], [ -87.629875544247383, 41.842337156372679 ], [ -87.629884571751219, 41.842786172707797 ], [ -87.629904880537197, 41.843344479660928 ], [ -87.629914250939578, 41.843762213451434 ], [ -87.62992853162325, 41.844275668802169 ], [ -87.629930607114375, 41.844346292142021 ], [ -87.629944725119529, 41.844799730309134 ], [ -87.629962225405095, 41.845413453899255 ], [ -87.629965244456116, 41.845544832945166 ], [ -87.629965244405, 41.845544837610092 ], [ -87.629787010134351, 41.845545519305652 ], [ -87.629465634652817, 41.845553058289063 ], [ -87.629168184648378, 41.845556605815993 ], [ -87.628727001968386, 41.845561866414165 ], [ -87.628460687963994, 41.845566187369577 ], [ -87.628122693920702, 41.845570789625725 ], [ -87.62791754032429, 41.845573582786777 ], [ -87.627652124801756, 41.845576288272412 ], [ -87.627236960338777, 41.845579719177664 ], [ -87.626960868277962, 41.845585105803806 ], [ -87.626759948514987, 41.845589025578668 ], [ -87.626377088595191, 41.845596493519025 ], [ -87.626264621707648, 41.845598321530268 ], [ -87.626192077014053, 41.845599500330614 ], [ -87.626182687550127, 41.845599653005308 ], [ -87.626143818131183, 41.845600284709981 ], [ -87.62613206505813, 41.845600475791322 ], [ -87.626102772311114, 41.845600951847835 ], [ -87.625797360389868, 41.845606260785715 ], [ -87.625538903842326, 41.845610239172622 ], [ -87.625326100346484, 41.845613603233126 ], [ -87.624793263592309, 41.845622024937491 ], [ -87.624464844941016, 41.845626739987736 ], [ -87.624172590117809, 41.845630488582863 ], [ -87.624079576214086, 41.845631716391125 ], [ -87.623636204771756, 41.845638283661508 ], [ -87.623391914571869, 41.845641901278384 ], [ -87.622137729593817, 41.845660470156673 ], [ -87.620481331299587, 41.845684963325759 ], [ -87.620330598687488, 41.845687191273505 ], [ -87.618864203738838, 41.845710198033245 ], [ -87.617839878126574, 41.845726257985341 ], [ -87.617671405604312, 41.845723202569324 ], [ -87.617298523170078, 41.845668181344095 ], [ -87.617209851901592, 41.845655097125373 ], [ -87.616920911304703, 41.845644513570335 ], [ -87.616661179180809, 41.845644375074727 ], [ -87.616618250647406, 41.845643283921682 ], [ -87.616595031831281, 41.845642151095802 ], [ -87.616571834701844, 41.845639042534557 ], [ -87.616550664385088, 41.845631940000438 ], [ -87.616526267962854, 41.845617874354694 ], [ -87.616503931139562, 41.845596878584573 ], [ -87.616477638606256, 41.845571878946174 ], [ -87.616457986261523, 41.84555037851289 ], [ -87.616437889136634, 41.845526048713836 ], [ -87.616259548073216, 41.84523118998586 ], [ -87.616237799415288, 41.845200236176623 ], [ -87.616217495088478, 41.845178045565817 ], [ -87.616196271835406, 41.845159169766525 ], [ -87.616168759330293, 41.845141626821842 ], [ -87.616139403451967, 41.845128051534694 ], [ -87.616100212138861, 41.845114442263537 ], [ -87.616073534564563, 41.845104231954608 ], [ -87.616035200970032, 41.845095979047379 ], [ -87.616008404203214, 41.845093122317436 ], [ -87.615961805120151, 41.845092172650482 ], [ -87.615112639990286, 41.845106871334231 ], [ -87.614992706295993, 41.845109933063007 ], [ -87.615000791319289, 41.845166216229437 ], [ -87.614000689968677, 41.845166474560351 ], [ -87.613501099439929, 41.845166431553039 ], [ -87.612400991577914, 41.845166392439829 ], [ -87.6119296332906, 41.845225180519478 ], [ -87.611580889079903, 41.845266234632355 ], [ -87.611410604981771, 41.845266548906181 ], [ -87.611122564117707, 41.845266438938452 ], [ -87.610916549223845, 41.84526644821301 ], [ -87.609406145406311, 41.845266503985897 ], [ -87.609409491822717, 41.845217733268257 ], [ -87.609376580922756, 41.845153382636624 ], [ -87.609140876178913, 41.84469250265397 ] ] ] } },
Above is a sample of the GeoJSON file, containing the header and a sample polygon. You can see there is a long list of coordinates defining the polygon's points, as well as a list of properties that can be used as a polygon's ID.
We'll use the area_num_1
as the a community area ID, so that we can blend our
shapefile together with additional Chicago Crime data.
The Chicago Crime dataset is quite large and not included in the repo, but you can download it for free online online (we use the CSV export).
Since the datafile is so big and our simple heatmap only needs # of crimes per
community area per year, we pre-aggregate the download with another PDI
transformation: preaggregate-Chicago-Crime-Data.ktr
. As written, this produces
a much smaller file Aggregated-Crime-Counts.csv
with just the 3 columns we
need: Year, Community Area, and Crimes.
Crucially, this data still contains the same Community Area ID that our ESRI/GeoJSON data has. This will allow us to blend the two datasources together into our heat map on the fly.
Now to create our actual map in Pentaho we will use the C*Tools Community Dashboard Editor (CDE). You can upload the examples provided, but the basic gist involves using the NewMapComponent under the Components View.
This gives you a mapping engine that renders the world for free (you can choose between OpenLayers or Google engines). Then, on top of this you can use GeoJSON or KML to plot polygons above the map.
This is mostly done through JavaScript snippets in the Component Lifecycle steps, such as Pre-Execution or Post-Execution.
You should be able to zip & upload the repository onto the BA server to explore the example provided. This guide is heavily indebted to Kleyson R's NMC-samples repository, which has similar examples and can also be zipped & uploaded for exploring.
As a brief example here, we can load our GeoJSON file with the following JavaScript in our Pre-Execution stage:
// locate our GeoJSON file under resources. Note, the BA server does not
// recognize the .geojson extension, so we rename to .js
var getResource = this.dashboard.getWebAppPath() + '/plugin/pentaho-cdf-dd/api/resources';
var mapDef = '${solution:resources/geojson/community-areas-current-geojson.js}';
// here we pass in our GeoJSON file, and also specify the GeoJSON property
// to use as a polygon ID
this.shapeResolver = 'geoJSON';
this.setAddInOptions('ShapeResolver', 'geoJSON', {
url: getResource + mapDef,
idPropertyName: 'area_num_1'
});
This will plot the polygons, with 1 caveat. The NewMapComponent also takes a
Datasource
as input (see the Properties tab). This datasource must contain
data that matches the IDs specified above in the GeoJSON file, and only those
polygons for which datapoints with matching IDs exist will be rendered.
We can specify which columns from our datasource to use as the ID in a snippet also in the Pre-Execution phase like so:
this.visualRoles = {
id: 0, // communityarea
fill: 1 // crimes
};
Note, here we defined the column for id
as the first column (index 0), and use
the 2nd column (index 1) as the fill value (more below).
To load our pre-aggregated data and render it on our map, we use a Kettle
transformation datasource in CDE that reads the
/resources/ktr/loadChicagoCrime.ktr
file, which takes a year parameter and
simply reads & filters the Aggregated-Crime-Counts.csv
file.
This transformation ensures that the 1st column is the Community Area ID and the 2nd column is the # of crimes, to match our JavaScript above.
Finally, more JavaScript can be added to add additional dashboard features. For our Heat Map example, we want to vary the fill color based on # of crimes.
We've already linked the data with the code snippet above. The NewMapComponent has some defaults, but to ensure it works smoothly we can implement the fill function ourselves as follows:
// define the polygon's fill function manually based on the crimes/fill
// value incoming from the datasource
this.attributeMapping.fill = function(context, seriesRoot, mapping, row) {
var value = row[mapping.fill];
if (_.isNumber(value)) {
return this.mapColor(value,
0, // min crimes
17336, // max crimes from dataset
this.getColorMap() // a default color map of green->red
);
}
};
The above function validates the incoming fill/crimes column, and then tweaks the default colormap (green to red) and maps all values on a scale of 0 to 17,336. All values between will be somehwere on the gradient.
Additional code snippets can be found in the example for powering a tooltip that indicates the # of crimes when hovering over each neighborhood, and specifically Kleyson R's samples has many other nifty features that can be added to the NewMapComponent.