Skip to content

Instantly share code, notes, and snippets.

@sorcereral
Forked from mbostock/.block
Last active January 10, 2020 08:54
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sorcereral/4959573 to your computer and use it in GitHub Desktop.
Save sorcereral/4959573 to your computer and use it in GitHub Desktop.
Google Map with a contour plot using Jason Davies' conrec.js.
[[25.0,-40.0,0],[25.0,-37.5,0],[25.0,-35.0,0.365768700838089],[25.0,-32.5,3.3441708087921143],[25.0,-30.0,8.430097579956055],[25.0,-27.5,22.805387496948242],[25.0,-25.0,59.411285400390625],[25.0,-22.5,79.77821350097656],[25.0,-20.0,90.1242446899414],[25.0,-17.5,92.36530303955078],[25.0,-15.0,92.00534057617188],[25.0,-12.5,91.14026641845703],[25.0,-10.0,84.85253143310547],[25.0,-7.5,57.04249954223633],[25.0,-5.0,45.55271530151367],[25.0,-2.5,21.353925704956055],[25.0,0.0,16.088016510009766],[25.0,2.5,13.399907112121582],[25.0,5.0,16.912446975708008],[25.0,7.5,15.426149368286133],[25.0,10.0,19.408964157104492],[25.0,12.5,22.073850631713867],[25.0,15.0,24.1929874420166],[25.0,17.5,21.45842933654785],[25.0,20.0,26.915931701660156],[25.0,22.5,30.260101318359375],[25.0,25.0,36.20529556274414],[25.0,27.5,33.83650588989258],[25.0,30.0,28.50092887878418],[25.0,32.5,15.35647964477539],[25.0,35.0,8.714584350585938],[25.0,37.5,0.9231305122375488],[25.0,40.0,0],[25.0,42.5,0],[25.0,45.0,0],[25.0,47.5,0],[25.0,50.0,0],[25.0,52.5,0],[25.0,55.0,0],[27.5,-40.0,0],[27.5,-37.5,0],[27.5,-35.0,0.841848611831665],[27.5,-32.5,6.508360385894775],[27.5,-30.0,19.310264587402344],[27.5,-27.5,51.52113342285156],[27.5,-25.0,77.28170013427734],[27.5,-22.5,92.10404205322266],[27.5,-20.0,98.7575454711914],[27.5,-17.5,99.12911987304688],[27.5,-15.0,97.9737548828125],[27.5,-12.5,98.16535186767578],[27.5,-10.0,95.33789825439453],[27.5,-7.5,93.39293670654297],[27.5,-5.0,73.67626190185547],[27.5,-2.5,60.29377746582031],[27.5,0.0,46.71969223022461],[27.5,2.5,32.81467819213867],[27.5,5.0,31.125173568725586],[27.5,7.5,36.50139236450195],[27.5,10.0,38.69020080566406],[27.5,12.5,41.0764045715332],[27.5,15.0,40.83836364746094],[27.5,17.5,45.541107177734375],[27.5,20.0,45.84881591796875],[27.5,22.5,56.0380859375],[27.5,25.0,59.09196472167969],[27.5,27.5,59.26033401489258],[27.5,30.0,49.2452392578125],[27.5,32.5,42.96330642700195],[27.5,35.0,22.996980667114258],[27.5,37.5,8.952624320983887],[27.5,40.0,2.3339526653289795],[27.5,42.5,0],[27.5,45.0,0],[27.5,47.5,0],[27.5,50.0,0],[27.5,52.5,0],[27.5,55.0,0],[30.0,-40.0,0],[30.0,-37.5,0.15095216035842896],[30.0,-35.0,3.274500608444214],[30.0,-32.5,17.55109214782715],[30.0,-30.0,46.88225555419922],[30.0,-27.5,71.7138900756836],[30.0,-25.0,94.2638168334961],[30.0,-22.5,99.91871643066406],[30.0,-20.0,99.91871643066406],[30.0,-17.5,99.91871643066406],[30.0,-15.0,99.91871643066406],[30.0,-12.5,99.91871643066406],[30.0,-10.0,99.91871643066406],[30.0,-7.5,99.6980972290039],[30.0,-5.0,99.50069427490234],[30.0,-2.5,94.3567123413086],[30.0,0.0,93.95030212402344],[30.0,2.5,93.07942199707031],[30.0,5.0,93.41035461425781],[30.0,7.5,94.4496078491211],[30.0,10.0,96.49906921386719],[30.0,12.5,96.35392761230469],[30.0,15.0,95.65721893310547],[30.0,17.5,93.81676483154297],[30.0,20.0,93.33488464355469],[30.0,22.5,95.6281967163086],[30.0,25.0,96.59196472167969],[30.0,27.5,96.51648712158203],[30.0,30.0,94.82698822021484],[30.0,32.5,90.2171401977539],[30.0,35.0,69.57733154296875],[30.0,37.5,36.62331771850586],[30.0,40.0,12.813515663146973],[30.0,42.5,0],[30.0,45.0,0],[30.0,47.5,0],[30.0,50.0,0],[30.0,52.5,0],[30.0,55.0,0],[32.5,-40.0,0.06386437267065048],[32.5,-37.5,1.7882025241851807],[32.5,-35.0,11.658151626586914],[32.5,-32.5,31.996051788330078],[32.5,-30.0,62.75545883178711],[32.5,-27.5,92.85880279541016],[32.5,-25.0,99.68648529052734],[32.5,-22.5,99.91871643066406],[32.5,-20.0,99.91871643066406],[32.5,-17.5,99.91871643066406],[32.5,-15.0,99.91871643066406],[32.5,-12.5,99.91871643066406],[32.5,-10.0,99.91871643066406],[32.5,-7.5,99.91871643066406],[32.5,-5.0,99.91871643066406],[32.5,-2.5,99.8432388305664],[32.5,0.0,99.47747039794922],[32.5,2.5,99.22201538085938],[32.5,5.0,99.34974670410156],[32.5,7.5,99.75615692138672],[32.5,10.0,99.91871643066406],[32.5,12.5,99.91871643066406],[32.5,15.0,99.91291046142578],[32.5,17.5,99.91871643066406],[32.5,20.0,98.6124038696289],[32.5,22.5,99.91871643066406],[32.5,25.0,99.79679870605469],[32.5,27.5,99.79679870605469],[32.5,30.0,99.73873901367188],[32.5,32.5,99.19298553466797],[32.5,35.0,94.33929443359375],[32.5,37.5,79.56920623779297],[32.5,40.0,34.56804275512695],[32.5,42.5,0],[32.5,45.0,0],[32.5,47.5,0],[32.5,50.0,0],[32.5,52.5,0],[32.5,55.0,0],[35.0,-40.0,0.5109149813652039],[35.0,-37.5,6.996051788330078],[35.0,-35.0,24.912912368774414],[35.0,-32.5,45.29726028442383],[35.0,-30.0,83.07594299316406],[35.0,-27.5,97.86925506591797],[35.0,-25.0,99.91871643066406],[35.0,-22.5,99.91871643066406],[35.0,-20.0,99.91871643066406],[35.0,-17.5,99.91871643066406],[35.0,-15.0,99.91871643066406],[35.0,-12.5,99.91871643066406],[35.0,-10.0,99.91871643066406],[35.0,-7.5,99.91871643066406],[35.0,-5.0,99.91871643066406],[35.0,-2.5,99.91871643066406],[35.0,0.0,99.91871643066406],[35.0,2.5,99.91871643066406],[35.0,5.0,99.91871643066406],[35.0,7.5,99.91871643066406],[35.0,10.0,99.91871643066406],[35.0,12.5,99.91871643066406],[35.0,15.0,99.91871643066406],[35.0,17.5,99.91871643066406],[35.0,20.0,99.91871643066406],[35.0,22.5,99.91871643066406],[35.0,25.0,99.91871643066406],[35.0,27.5,99.91871643066406],[35.0,30.0,99.91871643066406],[35.0,32.5,99.91871643066406],[35.0,35.0,99.53553009033203],[35.0,37.5,93.54969787597656],[35.0,40.0,66.62796020507812],[35.0,42.5,0],[35.0,45.0,0],[35.0,47.5,0],[35.0,50.0,0],[35.0,52.5,0],[35.0,55.0,0],[37.5,-40.0,2.4500696659088135],[37.5,-37.5,9.626103401184082],[37.5,-35.0,27.90873146057129],[37.5,-32.5,47.8692512512207],[37.5,-30.0,73.15373992919922],[37.5,-27.5,97.22480010986328],[37.5,-25.0,99.6980972290039],[37.5,-22.5,99.91871643066406],[37.5,-20.0,99.91871643066406],[37.5,-17.5,99.91871643066406],[37.5,-15.0,99.91871643066406],[37.5,-12.5,99.91871643066406],[37.5,-10.0,99.91871643066406],[37.5,-7.5,99.91871643066406],[37.5,-5.0,99.91871643066406],[37.5,-2.5,99.91871643066406],[37.5,0.0,99.91871643066406],[37.5,2.5,99.91871643066406],[37.5,5.0,99.91871643066406],[37.5,7.5,99.91871643066406],[37.5,10.0,99.91871643066406],[37.5,12.5,99.91871643066406],[37.5,15.0,99.91871643066406],[37.5,17.5,99.91871643066406],[37.5,20.0,99.91871643066406],[37.5,22.5,99.91871643066406],[37.5,25.0,99.91871643066406],[37.5,27.5,99.91871643066406],[37.5,30.0,99.91871643066406],[37.5,32.5,99.86646270751953],[37.5,35.0,99.6980972290039],[37.5,37.5,98.72270965576172],[37.5,40.0,80.23687744140625],[37.5,42.5,0],[37.5,45.0,0],[37.5,47.5,0],[37.5,50.0,0],[37.5,52.5,0],[37.5,55.0,0],[40.0,-40.0,1.3005108833312988],[40.0,-37.5,7.3502092361450195],[40.0,-35.0,21.168136596679688],[40.0,-32.5,42.969112396240234],[40.0,-30.0,67.83557891845703],[40.0,-27.5,88.08638763427734],[40.0,-25.0,99.6980972290039],[40.0,-22.5,99.6980972290039],[40.0,-20.0,99.91871643066406],[40.0,-17.5,99.91871643066406],[40.0,-15.0,99.91871643066406],[40.0,-12.5,99.91871643066406],[40.0,-10.0,99.91871643066406],[40.0,-7.5,99.91871643066406],[40.0,-5.0,99.91871643066406],[40.0,-2.5,99.91871643066406],[40.0,0.0,99.91871643066406],[40.0,2.5,99.91871643066406],[40.0,5.0,99.91871643066406],[40.0,7.5,99.91871643066406],[40.0,10.0,99.91871643066406],[40.0,12.5,99.91871643066406],[40.0,15.0,99.91871643066406],[40.0,17.5,99.91871643066406],[40.0,20.0,99.91871643066406],[40.0,22.5,99.91871643066406],[40.0,25.0,99.91871643066406],[40.0,27.5,99.91871643066406],[40.0,30.0,99.6980972290039],[40.0,32.5,99.6980972290039],[40.0,35.0,99.6980972290039],[40.0,37.5,98.3046875],[40.0,40.0,83.80747985839844],[40.0,42.5,0],[40.0,45.0,0],[40.0,47.5,0],[40.0,50.0,0],[40.0,52.5,0],[40.0,55.0,0],[42.5,-40.0,0.8766837120056152],[42.5,-37.5,5.532977104187012],[42.5,-35.0,10.990478515625],[42.5,-32.5,35.20088195800781],[42.5,-30.0,57.04830551147461],[42.5,-27.5,85.43891906738281],[42.5,-25.0,94.6876449584961],[42.5,-22.5,99.6980972290039],[42.5,-20.0,99.576171875],[42.5,-17.5,99.91871643066406],[42.5,-15.0,99.91871643066406],[42.5,-12.5,99.91871643066406],[42.5,-10.0,99.91871643066406],[42.5,-7.5,99.91871643066406],[42.5,-5.0,99.91871643066406],[42.5,-2.5,99.91871643066406],[42.5,0.0,99.91871643066406],[42.5,2.5,99.91871643066406],[42.5,5.0,99.91871643066406],[42.5,7.5,99.91871643066406],[42.5,10.0,99.91871643066406],[42.5,12.5,99.91871643066406],[42.5,15.0,99.91871643066406],[42.5,17.5,99.91871643066406],[42.5,20.0,99.91871643066406],[42.5,22.5,99.91871643066406],[42.5,25.0,99.91871643066406],[42.5,27.5,99.91871643066406],[42.5,30.0,99.6980972290039],[42.5,32.5,99.6980972290039],[42.5,35.0,99.47747039794922],[42.5,37.5,95.28564453125],[42.5,40.0,79.11054229736328],[42.5,42.5,0],[42.5,45.0,0],[42.5,47.5,0],[42.5,50.0,0],[42.5,52.5,0],[42.5,55.0,0],[45.0,-40.0,0.48769158124923706],[45.0,-37.5,2.984208106994629],[45.0,-35.0,5.950998783111572],[45.0,-32.5,18.37552261352539],[45.0,-30.0,46.71969223022461],[45.0,-27.5,72.3409194946289],[45.0,-25.0,90.66999816894531],[45.0,-22.5,95.45982360839844],[45.0,-20.0,99.23943328857422],[45.0,-17.5,99.77357482910156],[45.0,-15.0,99.91871643066406],[45.0,-12.5,99.91871643066406],[45.0,-10.0,99.91871643066406],[45.0,-7.5,99.91871643066406],[45.0,-5.0,99.91871643066406],[45.0,-2.5,99.91871643066406],[45.0,0.0,99.91871643066406],[45.0,2.5,99.91871643066406],[45.0,5.0,99.91871643066406],[45.0,7.5,99.91871643066406],[45.0,10.0,99.91871643066406],[45.0,12.5,99.91871643066406],[45.0,15.0,99.91871643066406],[45.0,17.5,99.91871643066406],[45.0,20.0,99.91871643066406],[45.0,22.5,99.91871643066406],[45.0,25.0,99.91871643066406],[45.0,27.5,99.7329330444336],[45.0,30.0,99.6980972290039],[45.0,32.5,99.70970916748047],[45.0,35.0,98.70529174804688],[45.0,37.5,85.90919494628906],[45.0,40.0,71.0171890258789],[45.0,42.5,0],[45.0,45.0,0],[45.0,47.5,0],[45.0,50.0,0],[45.0,52.5,0],[45.0,55.0,0],[47.5,-40.0,0.7721783518791199],[47.5,-37.5,1.1089178323745728],[47.5,-35.0,4.853692531585693],[47.5,-32.5,10.978866577148438],[47.5,-30.0,25.882490158081055],[47.5,-27.5,53.77960968017578],[47.5,-25.0,76.54435729980469],[47.5,-22.5,95.0766372680664],[47.5,-20.0,98.3046875],[47.5,-17.5,99.91871643066406],[47.5,-15.0,99.91871643066406],[47.5,-12.5,99.91871643066406],[47.5,-10.0,99.91871643066406],[47.5,-7.5,99.91871643066406],[47.5,-5.0,99.91871643066406],[47.5,-2.5,99.91871643066406],[47.5,0.0,99.91871643066406],[47.5,2.5,99.91871643066406],[47.5,5.0,99.91871643066406],[47.5,7.5,99.91871643066406],[47.5,10.0,99.91871643066406],[47.5,12.5,99.91871643066406],[47.5,15.0,99.91871643066406],[47.5,17.5,99.91871643066406],[47.5,20.0,99.91871643066406],[47.5,22.5,99.91871643066406],[47.5,25.0,99.91871643066406],[47.5,27.5,99.6980972290039],[47.5,30.0,99.6980972290039],[47.5,32.5,98.86205291748047],[47.5,35.0,95.51207733154297],[47.5,37.5,78.52415466308594],[47.5,40.0,57.34440231323242],[47.5,42.5,0],[47.5,45.0,0],[47.5,47.5,0],[47.5,50.0,0],[47.5,52.5,0],[47.5,55.0,0],[50.0,-40.0,0.9057129621505737],[50.0,-37.5,1.3875987529754639],[50.0,-35.0,4.60404109954834],[50.0,-32.5,9.138411521911621],[50.0,-30.0,18.601951599121094],[50.0,-27.5,40.46678924560547],[50.0,-25.0,70.18695068359375],[50.0,-22.5,88.26637268066406],[50.0,-20.0,97.7647476196289],[50.0,-17.5,99.44844055175781],[50.0,-15.0,99.91871643066406],[50.0,-12.5,99.91871643066406],[50.0,-10.0,99.91871643066406],[50.0,-7.5,99.91871643066406],[50.0,-5.0,99.91871643066406],[50.0,-2.5,99.91871643066406],[50.0,0.0,99.91871643066406],[50.0,2.5,99.91871643066406],[50.0,5.0,99.91871643066406],[50.0,7.5,99.91871643066406],[50.0,10.0,99.91871643066406],[50.0,12.5,99.91871643066406],[50.0,15.0,99.91871643066406],[50.0,17.5,99.91871643066406],[50.0,20.0,99.91871643066406],[50.0,22.5,99.91871643066406],[50.0,25.0,99.91871643066406],[50.0,27.5,99.70970916748047],[50.0,30.0,98.25824737548828],[50.0,32.5,97.45123291015625],[50.0,35.0,88.51021575927734],[50.0,37.5,71.06362915039062],[50.0,40.0,47.375755310058594],[50.0,42.5,0],[50.0,45.0,0],[50.0,47.5,0],[50.0,50.0,0],[50.0,52.5,0],[50.0,55.0,0],[52.5,-40.0,0.5631676912307739],[52.5,-37.5,1.480492353439331],[52.5,-35.0,4.5692057609558105],[52.5,-32.5,10.973060607910156],[52.5,-30.0,22.486066818237305],[52.5,-27.5,49.18717956542969],[52.5,-25.0,75.31351470947266],[52.5,-22.5,90.1881103515625],[52.5,-20.0,98.36274719238281],[52.5,-17.5,99.5123062133789],[52.5,-15.0,99.91871643066406],[52.5,-12.5,99.91871643066406],[52.5,-10.0,99.91871643066406],[52.5,-7.5,99.91871643066406],[52.5,-5.0,99.91871643066406],[52.5,-2.5,99.91871643066406],[52.5,0.0,99.91871643066406],[52.5,2.5,99.91871643066406],[52.5,5.0,99.91871643066406],[52.5,7.5,99.91871643066406],[52.5,10.0,99.91871643066406],[52.5,12.5,99.91871643066406],[52.5,15.0,99.91871643066406],[52.5,17.5,99.91871643066406],[52.5,20.0,99.91871643066406],[52.5,22.5,99.91871643066406],[52.5,25.0,99.6980972290039],[52.5,27.5,99.6980972290039],[52.5,30.0,99.02462005615234],[52.5,32.5,97.72991180419922],[52.5,35.0,90.19972229003906],[52.5,37.5,77.01463317871094],[52.5,40.0,55.143985748291016],[52.5,42.5,0.6676729917526245],[52.5,45.0,0],[52.5,47.5,0],[52.5,50.0,0],[52.5,52.5,0],[52.5,55.0,0],[55.0,-40.0,1.1669763326644897],[55.0,-37.5,3.942173719406128],[55.0,-35.0,9.382257461547852],[55.0,-32.5,23.92591667175293],[55.0,-30.0,47.74732971191406],[55.0,-27.5,69.82118225097656],[55.0,-25.0,82.14119720458984],[55.0,-22.5,93.55550384521484],[55.0,-20.0,99.14073181152344],[55.0,-17.5,99.5123062133789],[55.0,-15.0,99.91291046142578],[55.0,-12.5,99.91871643066406],[55.0,-10.0,99.91871643066406],[55.0,-7.5,99.91871643066406],[55.0,-5.0,99.91871643066406],[55.0,-2.5,99.91871643066406],[55.0,0.0,99.91871643066406],[55.0,2.5,99.91871643066406],[55.0,5.0,99.91871643066406],[55.0,7.5,99.91871643066406],[55.0,10.0,99.91871643066406],[55.0,12.5,99.91871643066406],[55.0,15.0,99.91871643066406],[55.0,17.5,99.91871643066406],[55.0,20.0,99.91871643066406],[55.0,22.5,99.91871643066406],[55.0,25.0,99.71551513671875],[55.0,27.5,99.6980972290039],[55.0,30.0,99.6980972290039],[55.0,32.5,99.46585845947266],[55.0,35.0,98.3685531616211],[55.0,37.5,92.1214599609375],[55.0,40.0,78.8028335571289],[55.0,42.5,0.899907112121582],[55.0,45.0,0.5631676912307739],[55.0,47.5,0],[55.0,50.0,0],[55.0,52.5,0],[55.0,55.0,0],[57.5,-40.0,6.125174045562744],[57.5,-37.5,13.417325019836426],[57.5,-35.0,27.868091583251953],[57.5,-32.5,49.761959075927734],[57.5,-30.0,67.48722839355469],[57.5,-27.5,82.98885345458984],[57.5,-25.0,91.07640838623047],[57.5,-22.5,98.81560516357422],[57.5,-20.0,99.70390319824219],[57.5,-17.5,99.91291046142578],[57.5,-15.0,99.91291046142578],[57.5,-12.5,99.91871643066406],[57.5,-10.0,99.91871643066406],[57.5,-7.5,99.91871643066406],[57.5,-5.0,99.91871643066406],[57.5,-2.5,99.91871643066406],[57.5,0.0,99.91871643066406],[57.5,2.5,99.91871643066406],[57.5,5.0,99.91871643066406],[57.5,7.5,99.91871643066406],[57.5,10.0,99.91871643066406],[57.5,12.5,99.91871643066406],[57.5,15.0,99.91871643066406],[57.5,17.5,99.91871643066406],[57.5,20.0,99.91871643066406],[57.5,22.5,99.91871643066406],[57.5,25.0,99.91871643066406],[57.5,27.5,99.8432388305664],[57.5,30.0,99.91871643066406],[57.5,32.5,99.78518676757812],[57.5,35.0,99.50650024414062],[57.5,37.5,99.30329895019531],[57.5,40.0,92.67301177978516],[57.5,42.5,1.4688806533813477],[57.5,45.0,0],[57.5,47.5,0],[57.5,50.0,0],[57.5,52.5,0],[57.5,55.0,0],[60.0,-40.0,18.387134552001953],[60.0,-37.5,27.014631271362305],[60.0,-35.0,50.725730895996094],[60.0,-32.5,70.99977111816406],[60.0,-30.0,86.67556762695312],[60.0,-27.5,95.26822662353516],[60.0,-25.0,99.14653778076172],[60.0,-22.5,99.80260467529297],[60.0,-20.0,99.86646270751953],[60.0,-17.5,99.91291046142578],[60.0,-15.0,99.91871643066406],[60.0,-12.5,99.91871643066406],[60.0,-10.0,99.91871643066406],[60.0,-7.5,99.91871643066406],[60.0,-5.0,99.91871643066406],[60.0,-2.5,99.91871643066406],[60.0,0.0,99.91871643066406],[60.0,2.5,99.91871643066406],[60.0,5.0,99.91871643066406],[60.0,7.5,99.91871643066406],[60.0,10.0,99.91871643066406],[60.0,12.5,99.91871643066406],[60.0,15.0,99.91871643066406],[60.0,17.5,99.91871643066406],[60.0,20.0,99.91871643066406],[60.0,22.5,99.91871643066406],[60.0,25.0,99.91871643066406],[60.0,27.5,99.91871643066406],[60.0,30.0,99.91871643066406],[60.0,32.5,99.91871643066406],[60.0,35.0,99.91871643066406],[60.0,37.5,98.8504409790039],[60.0,40.0,97.77055358886719],[60.0,42.5,3.9073386192321777],[60.0,45.0,0.6502554416656494],[60.0,47.5,0],[60.0,50.0,0],[60.0,52.5,0],[60.0,55.0,0],[62.5,-40.0,38.4811897277832],[62.5,-37.5,61.62912368774414],[62.5,-35.0,82.3734359741211],[62.5,-32.5,94.199951171875],[62.5,-30.0,97.77635955810547],[62.5,-27.5,98.71109771728516],[62.5,-25.0,99.91871643066406],[62.5,-22.5,99.91871643066406],[62.5,-20.0,99.91871643066406],[62.5,-17.5,99.91871643066406],[62.5,-15.0,99.91871643066406],[62.5,-12.5,99.91871643066406],[62.5,-10.0,99.91871643066406],[62.5,-7.5,99.91871643066406],[62.5,-5.0,99.91871643066406],[62.5,-2.5,99.91871643066406],[62.5,0.0,99.91871643066406],[62.5,2.5,99.91871643066406],[62.5,5.0,99.91871643066406],[62.5,7.5,99.91871643066406],[62.5,10.0,99.91871643066406],[62.5,12.5,99.91871643066406],[62.5,15.0,99.91871643066406],[62.5,17.5,99.91871643066406],[62.5,20.0,99.91871643066406],[62.5,22.5,99.91871643066406],[62.5,25.0,99.91871643066406],[62.5,27.5,99.91871643066406],[62.5,30.0,99.91871643066406],[62.5,32.5,99.91871643066406],[62.5,35.0,99.91871643066406],[62.5,37.5,99.91871643066406],[62.5,40.0,99.65745544433594],[62.5,42.5,5.596841812133789],[62.5,45.0,1.8114259243011475],[62.5,47.5,0.2786809206008911],[62.5,50.0,0],[62.5,52.5,0],[62.5,55.0,0],[65.0,-40.0,64.7004165649414],[65.0,-37.5,81.1309814453125],[65.0,-35.0,90.24036407470703],[65.0,-32.5,95.88945770263672],[65.0,-30.0,98.93753051757812],[65.0,-27.5,99.91871643066406],[65.0,-25.0,99.91871643066406],[65.0,-22.5,99.91871643066406],[65.0,-20.0,99.91871643066406],[65.0,-17.5,99.91871643066406],[65.0,-15.0,99.91871643066406],[65.0,-12.5,99.91871643066406],[65.0,-10.0,99.91871643066406],[65.0,-7.5,99.91871643066406],[65.0,-5.0,99.91871643066406],[65.0,-2.5,99.91871643066406],[65.0,0.0,99.91871643066406],[65.0,2.5,99.91871643066406],[65.0,5.0,99.91871643066406],[65.0,7.5,99.91871643066406],[65.0,10.0,99.91871643066406],[65.0,12.5,99.91871643066406],[65.0,15.0,99.91871643066406],[65.0,17.5,99.91871643066406],[65.0,20.0,99.91871643066406],[65.0,22.5,99.91871643066406],[65.0,25.0,99.91871643066406],[65.0,27.5,99.91871643066406],[65.0,30.0,99.91871643066406],[65.0,32.5,99.91871643066406],[65.0,35.0,99.91871643066406],[65.0,37.5,99.91871643066406],[65.0,40.0,99.91871643066406],[65.0,42.5,26.904319763183594],[65.0,45.0,7.5882487297058105],[65.0,47.5,0.8070134520530701],[65.0,50.0,0.12192289531230927],[65.0,52.5,0],[65.0,55.0,0],[67.5,-40.0,72.60218048095703],[67.5,-37.5,86.6233139038086],[67.5,-35.0,92.2956314086914],[67.5,-32.5,95.63400268554688],[67.5,-30.0,98.26985931396484],[67.5,-27.5,99.7909927368164],[67.5,-25.0,99.91871643066406],[67.5,-22.5,99.91871643066406],[67.5,-20.0,99.91871643066406],[67.5,-17.5,99.91871643066406],[67.5,-15.0,99.91871643066406],[67.5,-12.5,99.91871643066406],[67.5,-10.0,99.91871643066406],[67.5,-7.5,99.91871643066406],[67.5,-5.0,99.91871643066406],[67.5,-2.5,99.91871643066406],[67.5,0.0,99.91871643066406],[67.5,2.5,99.91871643066406],[67.5,5.0,99.91871643066406],[67.5,7.5,99.91871643066406],[67.5,10.0,99.91871643066406],[67.5,12.5,99.91871643066406],[67.5,15.0,99.91871643066406],[67.5,17.5,99.91871643066406],[67.5,20.0,99.91871643066406],[67.5,22.5,99.91871643066406],[67.5,25.0,99.91871643066406],[67.5,27.5,99.91871643066406],[67.5,30.0,99.91871643066406],[67.5,32.5,99.91871643066406],[67.5,35.0,99.91871643066406],[67.5,37.5,99.91871643066406],[67.5,40.0,99.91871643066406],[67.5,42.5,31.96121597290039],[67.5,45.0,19.594751358032227],[67.5,47.5,6.549001216888428],[67.5,50.0,0.16836971044540405],[67.5,52.5,0],[67.5,55.0,0],[70.0,-40.0,67.96331024169922],[70.0,-37.5,81.54900360107422],[70.0,-35.0,89.53205108642578],[70.0,-32.5,93.56130981445312],[70.0,-30.0,97.22480010986328],[70.0,-27.5,99.08267211914062],[70.0,-25.0,99.25104522705078],[70.0,-22.5,99.91871643066406],[70.0,-20.0,99.91871643066406],[70.0,-17.5,99.91871643066406],[70.0,-15.0,99.91871643066406],[70.0,-12.5,99.91871643066406],[70.0,-10.0,99.89549255371094],[70.0,-7.5,99.91871643066406],[70.0,-5.0,99.91871643066406],[70.0,-2.5,99.91871643066406],[70.0,0.0,99.91871643066406],[70.0,2.5,99.91871643066406],[70.0,5.0,99.91871643066406],[70.0,7.5,99.91871643066406],[70.0,10.0,99.91871643066406],[70.0,12.5,99.91871643066406],[70.0,15.0,99.91871643066406],[70.0,17.5,99.91871643066406],[70.0,20.0,99.91871643066406],[70.0,22.5,99.91871643066406],[70.0,25.0,99.91871643066406],[70.0,27.5,99.91871643066406],[70.0,30.0,99.91871643066406],[70.0,32.5,99.91871643066406],[70.0,35.0,99.91871643066406],[70.0,37.5,99.91871643066406],[70.0,40.0,99.91871643066406],[70.0,42.5,27.496517181396484],[70.0,45.0,18.387134552001953],[70.0,47.5,9.440316200256348],[70.0,50.0,2.757779836654663],[70.0,52.5,0.45285648107528687],[70.0,55.0,0],[72.5,-40.0,60.39828109741211],[72.5,-37.5,72.7995834350586],[72.5,-35.0,80.48072814941406],[72.5,-32.5,86.72782135009766],[72.5,-30.0,92.00534057617188],[72.5,-27.5,97.49187469482422],[72.5,-25.0,98.77496337890625],[72.5,-22.5,99.19298553466797],[72.5,-20.0,99.75035095214844],[72.5,-17.5,99.86065673828125],[72.5,-15.0,99.88968658447266],[72.5,-12.5,99.8780746459961],[72.5,-10.0,99.8780746459961],[72.5,-7.5,99.88968658447266],[72.5,-5.0,99.88968658447266],[72.5,-2.5,99.91871643066406],[72.5,0.0,99.91871643066406],[72.5,2.5,99.91871643066406],[72.5,5.0,99.91871643066406],[72.5,7.5,99.91871643066406],[72.5,10.0,99.91871643066406],[72.5,12.5,99.91871643066406],[72.5,15.0,99.91871643066406],[72.5,17.5,99.91871643066406],[72.5,20.0,99.91871643066406],[72.5,22.5,99.91871643066406],[72.5,25.0,99.91871643066406],[72.5,27.5,99.91871643066406],[72.5,30.0,99.91871643066406],[72.5,32.5,99.91871643066406],[72.5,35.0,99.91871643066406],[72.5,37.5,99.7909927368164],[72.5,40.0,99.33232879638672],[72.5,42.5,21.66744041442871],[72.5,45.0,15.606130599975586],[72.5,47.5,7.48954963684082],[72.5,50.0,2.9958198070526123],[72.5,52.5,1.2134231328964233],[72.5,55.0,0.48769158124923706],[75.0,-40.0,39.06177520751953],[75.0,-37.5,52.09010696411133],[75.0,-35.0,63.41732406616211],[75.0,-32.5,75.04644775390625],[75.0,-30.0,85.1718521118164],[75.0,-27.5,90.41453552246094],[75.0,-25.0,93.92707824707031],[75.0,-22.5,96.17394256591797],[75.0,-20.0,98.10729217529297],[75.0,-17.5,99.05364227294922],[75.0,-15.0,99.52391815185547],[75.0,-12.5,99.6690673828125],[75.0,-10.0,99.88968658447266],[75.0,-7.5,99.88968658447266],[75.0,-5.0,99.88968658447266],[75.0,-2.5,99.91871643066406],[75.0,0.0,99.91871643066406],[75.0,2.5,99.91871643066406],[75.0,5.0,99.91871643066406],[75.0,7.5,99.91871643066406],[75.0,10.0,99.91871643066406],[75.0,12.5,99.55294799804688],[75.0,15.0,99.44263458251953],[75.0,17.5,99.32652282714844],[75.0,20.0,99.21040344238281],[75.0,22.5,99.11170196533203],[75.0,25.0,99.17556762695312],[75.0,27.5,99.1813735961914],[75.0,30.0,99.1813735961914],[75.0,32.5,98.90269470214844],[75.0,35.0,98.99559020996094],[75.0,37.5,98.08406829833984],[75.0,40.0,95.71527862548828],[75.0,42.5,7.344403266906738],[75.0,45.0,5.341383934020996],[75.0,47.5,2.8913145065307617],[75.0,50.0,1.085694432258606],[75.0,52.5,0.42382723093032837],[75.0,55.0,0.11031119525432587]]
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no"/>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script type="text/javascript" src="https://raw.github.com/jasondavies/conrec.js/master/conrec.js"></script>
<script src="https://raw.github.com/d3/d3-plugins/master/geom/contour/contour.js"></script>
<style type="text/css">
html, body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
#map {
width: 100%;
height: 100%;
}
.stations, .stations svg, .contour {
position: absolute;
}
.stations svg {
width: 60px;
height: 20px;
padding-right: 100px;
font: 8px sans-serif;
}
.stations circle {
fill: brown;
stroke: black;
stroke-width: 0.2px;
}
</style>
</head>
<body>
<div id="map"></div>
<script type="text/javascript">
// Create the Google Map…
var map = new google.maps.Map(d3.select("#map").node(), {
zoom : 3,
center : new google.maps.LatLng(30.0, 10.0),
mapTypeId : google.maps.MapTypeId.TERRAIN
});
// Load the data. When the data comes back, create an overlay.
d3.json("aaa.json", function (data) {
var overlay = new google.maps.OverlayView();
// Add the container when the overlay is added to the map.
overlay.onAdd = function () {
// Add the section that will contain the markers of the data points
var layer = d3.select(this.getPanes().overlayLayer).append("div")
.attr("class", "stations");
// Add the section that will contain the contour plot
var cont_layer = d3.select(this.getPanes().overlayLayer).append("div")
.attr("class","contour").append("svg:svg");
// Add a group to the SVG object; groups can be affected by the opacity
var cont_group = cont_layer.append("g").attr("opacity",0.3);
// Implement the overlay.draw method
overlay.draw = function () {
var projection = this.getProjection(),
padding = 10;
//___Add the data markers
// Draw each marker as a separate SVG element as in Mike Bostock's example for d3 and Google Maps
var marker = layer.selectAll("svg")
.data(d3.entries(data))
.each(transform) // update existing markers
.enter().append("svg:svg")
.each(transform)
.attr("class", "marker");
// Add a circle.
marker.append("svg:circle")
.attr("r", 1.5)
.attr("cx", padding)
.attr("cy", padding);
// Add a label.
marker.append("svg:text")
.attr("x", padding - 6)
.attr("y", padding + 6)
.attr("dy", ".31em")
.text(function (d) {
return (d.value[2].toFixed(2));//"("+d.value[0].toString()+", "+d.value[1].toString()+"): "+
});
//___Add the contour plot
// The data is provided as an array of [lat, lon, value] arrays and it need to be mapped to a grid.
// Determine the min and max latitudes and longitudes
var maxY = data[0][0];
var minY = data[0][0];
var maxX = data[0][1];
var minX = data[0][1];
var spacingX = 2.5;
var spacingY = 2.5;
data.forEach(function(val){
maxX=maxX>val[1]?maxX:val[1];
minX=minX<val[1]?minX:val[1];
maxY=maxY>val[0]?maxY:val[0];
minY=minY<val[0]?minY:val[0];
});
console.log("Mx = "+maxX+" mx = "+minX+" My = "+maxY+" my = "+minY + " => " +(maxX-minX)/spacingX+":"+(maxY-minY)/spacingY);
// Create a properly dimensioned array
var grid=new Array((maxX-minX)/spacingX+1);
for (var i=0;i<grid.length;i++)
grid[i] = Array((maxY-minY)/spacingY+1);
// Fill the grid with the values from the data array
data.forEach(function(val){grid[(val[1]-minX)/spacingX][(val[0]-minY)/spacingY]=val[2];});
//Add a "cliff edge" to force contour lines to close along the border.
var cliff = -100;
grid.push(d3.range(grid[0].length).map(function() { return cliff; }));
grid.unshift(d3.range(grid[0].length).map(function() { return cliff; }));
grid.forEach(function(nd) {
nd.push(cliff);
nd.unshift(cliff);
});
// determine the size of the SVG
var c2 = projection.fromLatLngToDivPixel(new google.maps.LatLng(minY, maxX));
var c1 = projection.fromLatLngToDivPixel(new google.maps.LatLng(maxY, minX));
var svgHeight = 8000; // c2.y - c1.y;
var svgWidth = 8000; // c2.x - c1.x;
var padX = -4000;
var padY = -4000;
console.log(svgHeight,svgWidth);
// set the size of the SVG contour layer
cont_layer
.attr("width",svgWidth)
.attr("height",svgHeight)
.style("position","absolute")
.style("top",padX)
.style("left",padY);
// conrec.js requires two arrays that represent the row and column coordinates.
// In this case these are an array of latitudes and one of longitudes
var latpy = new Array();
var lonpx = new Array();
// Adding the cliff implies extending the latitude and longitude arrays beyound the minimum and maximum
for (var i = 0; i < grid[0].length; i++)
latpy[i] = minY + 2.5 * (i-1);
for (var i = grid.length-1; i>=0; i--)
lonpx[i] = minX + 2.5 * (i-1);
// define the colours to be used and the corresponding limits
var colours = ['#000099','#0000FF','#3399FF','#00CCFF','#00CC00','#66FF00','#FFFF00','#CC0000','#FF6633'],
zs = [-0.1, 20.0, 50.0, 75.0, 90.0, 95.0, 98.0, 99.0, 99.9, 100.1];
// create a Conrec object and compute the contour
var c = new Conrec();
c.contour(grid, 0, lonpx.length-1, 0, latpy.length-1, lonpx, latpy, zs.length, zs);
// draw the contour plot following Jason Davies example for conrec.js and d3
var cont = cont_group.selectAll("path").data(c.contourList())
// update existing paths
.style("fill",function(d) {
return colours[zs.indexOf(d.level)-1];
})
.style("stroke","black")
.attr("d",d3.svg.line()
// the paths are given in lat and long coordinates that need to be changed into pixel coordinates
.x(function(d) { return (projection.fromLatLngToDivPixel(new google.maps.LatLng(d.y, d.x))).x - padX; })
.y(function(d) { return (projection.fromLatLngToDivPixel(new google.maps.LatLng(d.y, d.x))).y - padY; })
)
.enter().append("svg:path")
.style("fill",function(d) {
return colours[zs.indexOf(d.level)-1];
})
.style("stroke","black")
.attr("d",d3.svg.line()
// the paths are given in lat and long coordinates that need to be changed into pixel coordinates
.x(function(d) { return (projection.fromLatLngToDivPixel(new google.maps.LatLng(d.y, d.x))).x - padX; })
.y(function(d) { return (projection.fromLatLngToDivPixel(new google.maps.LatLng(d.y, d.x))).y - padY; })
);
// function for transforming the data marker
function transform(d) {
d = new google.maps.LatLng(d.value[0], d.value[1]);
d = projection.fromLatLngToDivPixel(d);
return d3.select(this)
.style("left", (d.x - padding) + "px")
.style("top", (d.y - padding) + "px");
}
};
};
// Bind our overlay to the map…
overlay.setMap(map);
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment