Thematic Mapping with Google Maps
"US-KS":{code:"US-KS", name:"Kansas", center:{lat: ,lng: }, EEHDPDGEDEDCFEFDPDGEFBDHCGEFEEGDEFDBFEHLIIIIKIHIGPJHHKIHJIIHLHGHKIIJJJMHIIEIKHJIJ KDIIHGMHAEEIEDFFCEDNCP", numLevels:18, zoomFactor:2}],}, Javascript for State of Kansas
Steps to Extending JS 1)Calculate centroids from shapefile in ArcMap 2)Export shapefile to KML 3)Use online tool to encode KML 4)Put all data in SAS 5)Join data and use SAS to write Javascript 6)Add new javascript to Cartographer.js
Add centroids to shapefile
Layer to KML
Unzip KMZ to view KML
Encode KML
filename encoded 'D:\data\ArcView\shptoKML\encodedKSCounties.txt'; /* read text file containing encoded KML for Kansas Counties */ data test; length points $1865 levels $461 ; infile encoded end=eof lrecl=2000 pad; 'points: "' points $1865. ; 'levels: "' levels $ ; run; SAS Code to read text file
proc sql; create table kml.encoded as select a.*, b.*, c.epoints, c.elevels from kml.countyabbv as a, centers as b, test2 as c where a.county=b.name and b.row=c.row; quit; SAS Code to join data
data _null_; set kml.encoded; put '"KS-' abbv +(-1) '":{code:"KS-' abbv +(-1) '",name:"' name +(-1) ' County, Kansas",center:{lat:' lat +(-1) ',lng:' lon +(-1) '}, polylines:[{ points: "' epoints +(-1) '", levels: "' elevels +(-1) '", numLevels:18,zoomFactor:2}],},'/; run; SAS code to write Javascript
Ready to create map var cartographer = Cartographer( map, { colorize:"#000", colorizeAlpha:.3 } ); cartographer.choropleth([ {region:"KS-DG",val:1855}, {region:"KS-JO",val:1855}, {region:"KS-SA",val:1860}, {region:"KS-EW",val:1867}, {region:"KS-MR",val:1855}, {region:"KS-OS",val:1855}, {region:"KS-LY",val:1857}, {region:"KS-FR",val:1855},…
Keys to Map Include both cartographer.js and raphael.js PHP dynamically writes map Javascript based on user input (variable selected, color, metric…) MySQL stores table of abbreviations, fips, etc which are joined with data to produce map
Xan Wedel Institute for Policy & Social Research The University of Kansas 607 Blake Hall Lawrence, KS