determine_region

A notebook to determine what region (e.g. neighborhood, ward, census district) the issue is referring to


In [117]:
import fiona
from shapely.geometry import shape
import nhrc2
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
from collections import defaultdict
import numpy as np
from matplotlib.patches import Polygon
from shapely.geometry import Point

%matplotlib inline

In [80]:
#the project root directory:
nhrc2dir = ('/').join(nhrc2.__file__.split('/')[:-1])+'/'

Read in neighborhood shapefiles:


In [ ]:
c = fiona.open(nhrc2dir+'data/nh_neighborhoods/nh_neighborhoods.shp')
pol = c.next()
geom = shape(pol['geometry'])

In [50]:
c.crs


Out[50]:
{'init': u'epsg:4326'}

In [33]:
for i in c.items():
    print(i[1])


{'geometry': {'type': 'Polygon', 'coordinates': [[(-72.91843899999999, 41.313173), (-72.921372, 41.314352), (-72.920858, 41.315444), (-72.919754, 41.317823), (-72.919323, 41.31873999999999), (-72.918906, 41.319638), (-72.918478, 41.320482), (-72.918431, 41.320571), (-72.917988, 41.321487), (-72.917782, 41.321893), (-72.91723299999998, 41.323046), (-72.916879, 41.323826), (-72.916488, 41.32467799999999), (-72.916348, 41.324973), (-72.915789, 41.326158), (-72.914894, 41.328111), (-72.91424399999998, 41.329431), (-72.914136, 41.329671), (-72.913966, 41.330012), (-72.913704, 41.330631), (-72.913621, 41.330819), (-72.91328999999999, 41.331576), (-72.913257, 41.331644), (-72.913086, 41.331999), (-72.912925, 41.332327), (-72.912529, 41.333192), (-72.911301, 41.332493), (-72.909651, 41.331517), (-72.909242, 41.33128), (-72.908947, 41.331103), (-72.908451, 41.330805), (-72.902536, 41.327202), (-72.89882199999998, 41.327902), (-72.897752, 41.32809799999999), (-72.8965, 41.328295), (-72.894741, 41.328669), (-72.89331, 41.328897), (-72.892895, 41.32801599999999), (-72.891692, 41.328471), (-72.889998, 41.326574), (-72.889471, 41.324999), (-72.890364, 41.324372999999994), (-72.891236, 41.323526), (-72.891629, 41.322419), (-72.891374, 41.321845), (-72.890299, 41.320984), (-72.891118, 41.320667), (-72.893132, 41.320167), (-72.89773299999999, 41.318845), (-72.904584, 41.317505), (-72.905431, 41.317035), (-72.905836, 41.316786), (-72.906164, 41.316613), (-72.906469, 41.316646), (-72.907458, 41.316697), (-72.907848, 41.31667), (-72.908268, 41.31657599999999), (-72.909581, 41.315749999999994), (-72.914247, 41.312767), (-72.91597599999999, 41.314022), (-72.917333, 41.314686), (-72.91843899999999, 41.313173)]]}, 'type': 'Feature', 'id': '0', 'properties': OrderedDict([(u'name', u'East Rock'), (u'created_at', '2013-08-22'), (u'updated_at', '2013-08-22'), (u'cartodb_id', 48)])}
{'geometry': {'type': 'Polygon', 'coordinates': [[(-72.95764999999999, 41.324757), (-72.95762, 41.324989), (-72.95747599999999, 41.325242), (-72.957288, 41.325139), (-72.956938, 41.324974), (-72.956419, 41.324652), (-72.95629, 41.324572), (-72.955987, 41.324353), (-72.955485, 41.323896999999995), (-72.954694, 41.32321), (-72.954298, 41.322866), (-72.954129, 41.322722), (-72.953731, 41.322367), (-72.953436, 41.322173), (-72.952961, 41.321824), (-72.952858, 41.321726), (-72.952668, 41.321595), (-72.952098, 41.321175), (-72.951813, 41.320981), (-72.950987, 41.320412), (-72.950414, 41.320008), (-72.950156, 41.319799), (-72.949343, 41.319247), (-72.949091, 41.319058), (-72.948611, 41.318915999999994), (-72.947545, 41.318532), (-72.946006, 41.317985), (-72.944563, 41.317424), (-72.94452, 41.317406), (-72.94387999999998, 41.317164), (-72.943551, 41.317046999999995), (-72.942412, 41.316657), (-72.942916, 41.315504), (-72.943043, 41.315216), (-72.94343599999999, 41.314248), (-72.943838, 41.313264), (-72.944169, 41.312336), (-72.944601, 41.31129099999999), (-72.945536, 41.311527), (-72.945828, 41.31157), (-72.94700199999998, 41.311843), (-72.948622, 41.312215), (-72.95037599999999, 41.312623), (-72.95205899999999, 41.313028), (-72.952551, 41.313119), (-72.952979, 41.313214), (-72.9534, 41.313309), (-72.956535, 41.314012), (-72.956587, 41.314403999999996), (-72.956711, 41.31575099999999), (-72.956809, 41.316696), (-72.956977, 41.318415), (-72.95699, 41.319051), (-72.957045, 41.319491), (-72.957274, 41.322213), (-72.957453, 41.323572), (-72.95764999999999, 41.324757)]]}, 'type': 'Feature', 'id': '1', 'properties': OrderedDict([(u'name', u'Edgewood'), (u'created_at', '2013-08-22'), (u'updated_at', '2013-08-22'), (u'cartodb_id', 19)])}
{'geometry': {'type': 'Polygon', 'coordinates': [[(-72.957426, 41.306691), (-72.957244, 41.307887), (-72.95695599999999, 41.308233), (-72.956822, 41.309338), (-72.95657699999998, 41.309709), (-72.95631, 41.310114), (-72.956296, 41.310459), (-72.956155, 41.310623), (-72.95609199999998, 41.311444), (-72.95604699999998, 41.312096), (-72.956164, 41.31252), (-72.95640299999998, 41.313466), (-72.956535, 41.314012), (-72.9534, 41.313309), (-72.952998, 41.313233), (-72.95257, 41.313148), (-72.95205899999999, 41.313028), (-72.95037599999999, 41.312623), (-72.948622, 41.312215), (-72.94700199999998, 41.311843), (-72.945828, 41.31157), (-72.94534399999999, 41.311472), (-72.944601, 41.31129099999999), (-72.94313, 41.310999), (-72.942629, 41.310887), (-72.942224, 41.310797), (-72.94140899999998, 41.310648), (-72.941432, 41.310588), (-72.940682, 41.310445), (-72.94025, 41.310359), (-72.939242, 41.310139), (-72.939791, 41.308714), (-72.939017, 41.308608), (-72.938652, 41.308498), (-72.938043, 41.308237), (-72.93857, 41.307516), (-72.938888, 41.307031), (-72.938977, 41.30685), (-72.939227, 41.306146), (-72.939476, 41.306136), (-72.940361, 41.30608899999999), (-72.940609, 41.306067), (-72.941559, 41.30607), (-72.942632, 41.306028), (-72.94329, 41.305981), (-72.943691, 41.305984), (-72.944555, 41.305961999999994), (-72.944772, 41.305957), (-72.94573, 41.305947), (-72.946922, 41.305889), (-72.9469, 41.305603), (-72.94677899999999, 41.305321), (-72.946145, 41.30461699999999), (-72.945533, 41.303972), (-72.944831, 41.303265), (-72.94461699999998, 41.303035), (-72.94446, 41.302723), (-72.944165, 41.302238), (-72.943211, 41.300515), (-72.943541, 41.300316), (-72.947315, 41.298192), (-72.94742799999999, 41.298095), (-72.94751199999999, 41.298036), (-72.947622, 41.297961), (-72.94773099999999, 41.298054), (-72.94886, 41.29755), (-72.948853, 41.297464999999995), (-72.948965, 41.297455), (-72.949576, 41.297398), (-72.950545, 41.297302), (-72.950747, 41.297275), (-72.951085, 41.297262), (-72.951424, 41.297768), (-72.952171, 41.298153), (-72.95245399999999, 41.299126), (-72.952644, 41.299435), (-72.95311, 41.299568), (-72.95369, 41.30003), (-72.95451, 41.300368999999996), (-72.955696, 41.301086), (-72.956299, 41.301605), (-72.95652, 41.302631), (-72.956858, 41.303025), (-72.956556, 41.30391), (-72.95674499999998, 41.305196), (-72.956695, 41.305323), (-72.956586, 41.30531299999999), (-72.956499, 41.30523), (-72.956396, 41.304845), (-72.95628, 41.304762), (-72.956076, 41.304786), (-72.955974, 41.305144), (-72.95609799999998, 41.305579), (-72.956353, 41.305691), (-72.956557, 41.305636), (-72.956724, 41.3055), (-72.956854, 41.30552), (-72.956952, 41.305699999999995), (-72.957426, 41.306691)]]}, 'type': 'Feature', 'id': '2', 'properties': OrderedDict([(u'name', u'West River'), (u'created_at', '2013-08-22'), (u'updated_at', '2013-08-22'), (u'cartodb_id', 6)])}
{'geometry': {'type': 'Polygon', 'coordinates': [[(-72.933731, 41.305558), (-72.937233, 41.306951), (-72.936697, 41.30769399999999), (-72.935979, 41.308611), (-72.935553, 41.30929), (-72.934468, 41.310621), (-72.93309299999999, 41.31248), (-72.932852, 41.312781), (-72.9328, 41.312863), (-72.93252, 41.312652), (-72.93234799999999, 41.312634), (-72.932166, 41.312698), (-72.932127, 41.312825), (-72.932256, 41.312903), (-72.932347, 41.313225), (-72.932447, 41.313825), (-72.929988, 41.315047), (-72.928878, 41.31522), (-72.928959, 41.315552), (-72.92897999999998, 41.315636), (-72.927224, 41.315297), (-72.926753, 41.315237), (-72.926841, 41.315423), (-72.927243, 41.316136), (-72.925707, 41.316238), (-72.925795, 41.317433), (-72.925956, 41.319205), (-72.925955, 41.320063), (-72.925892, 41.321348), (-72.925372, 41.321181), (-72.924267, 41.320947), (-72.923701, 41.320876), (-72.923303, 41.32060299999999), (-72.92330099999998, 41.320237), (-72.918906, 41.319638), (-72.921372, 41.314352), (-72.91843899999999, 41.313173), (-72.917333, 41.314686), (-72.91597599999999, 41.314022), (-72.914247, 41.312767), (-72.916272, 41.311434), (-72.916386, 41.311313), (-72.917338, 41.310669), (-72.91853099999999, 41.309900999999996), (-72.918619, 41.30937), (-72.919236, 41.307255999999995), (-72.920303, 41.303716), (-72.920408, 41.303136), (-72.92051699999999, 41.302598), (-72.92085, 41.301676), (-72.921055, 41.301296), (-72.920972, 41.300999), (-72.921005, 41.300857), (-72.921381, 41.301007), (-72.92155899999999, 41.301037), (-72.9225, 41.301074), (-72.924958, 41.301098), (-72.925568, 41.301133), (-72.92611199999999, 41.301269), (-72.926886, 41.301607), (-72.927669, 41.302014), (-72.928221, 41.302315), (-72.928462, 41.302457), (-72.92923399999998, 41.302865), (-72.929878, 41.30315), (-72.931204, 41.303935), (-72.931407, 41.304324), (-72.932596, 41.305044), (-72.933731, 41.305558)]]}, 'type': 'Feature', 'id': '3', 'properties': OrderedDict([(u'name', u'Downtown'), (u'created_at', '2013-08-22'), (u'updated_at', '2013-08-22'), (u'cartodb_id', 12)])}
{'geometry': {'type': 'Polygon', 'coordinates': [[(-72.997789, 41.31626), (-72.99719, 41.321333), (-72.997111, 41.322194), (-72.996809, 41.323599), (-72.99612199999999, 41.323893999999996), (-72.995917, 41.324055), (-72.99534, 41.324565), (-72.99504, 41.324892999999996), (-72.98894, 41.328893), (-72.988743, 41.330186), (-72.987296, 41.33124), (-72.98629, 41.330879), (-72.98624199999999, 41.330861), (-72.986195, 41.330841), (-72.985653, 41.330638), (-72.985347, 41.330547), (-72.984556, 41.330315), (-72.983927, 41.330142), (-72.983713, 41.330086), (-72.98272899999999, 41.329824), (-72.979897, 41.329075), (-72.97943, 41.328956), (-72.979215, 41.32892199999999), (-72.979045, 41.328862), (-72.978481, 41.328702), (-72.977416, 41.328432), (-72.977168, 41.328341), (-72.977099, 41.328324), (-72.976046, 41.328022), (-72.9757, 41.327927), (-72.974523, 41.327567), (-72.973836, 41.32735999999999), (-72.973474, 41.327268), (-72.97341999999999, 41.327255), (-72.973304, 41.32723399999999), (-72.973139, 41.327208), (-72.973014, 41.327196), (-72.972907, 41.327183), (-72.972797, 41.327172), (-72.972672, 41.327167), (-72.97213, 41.327183999999995), (-72.971806, 41.327206), (-72.97143399999999, 41.327244), (-72.970268, 41.327298), (-72.970148, 41.327303), (-72.969871, 41.32731999999999), (-72.969562, 41.327333), (-72.969525, 41.327335), (-72.969211, 41.327331), (-72.969197, 41.327331), (-72.969108, 41.32733), (-72.96813399999999, 41.327246), (-72.96523, 41.326874), (-72.965246, 41.328853), (-72.96500999999999, 41.328844), (-72.964815, 41.329285), (-72.964276, 41.330122), (-72.964212, 41.330434), (-72.963431, 41.330369), (-72.962217, 41.330243), (-72.961885, 41.330195), (-72.96163599999998, 41.330133999999994), (-72.960802, 41.32962), (-72.960628, 41.329423), (-72.960345, 41.328801), (-72.960167, 41.328354), (-72.95981799999998, 41.327804), (-72.959222, 41.327979), (-72.958785, 41.32811), (-72.958079, 41.328318), (-72.956089, 41.328884), (-72.955416, 41.328877999999996), (-72.955198, 41.328804), (-72.954594, 41.328501), (-72.953329, 41.327463), (-72.954553, 41.327019), (-72.95517899999999, 41.326813), (-72.955724, 41.326568), (-72.955907, 41.326434), (-72.95613699999998, 41.3262), (-72.956287, 41.325942), (-72.956938, 41.324974), (-72.95747599999999, 41.325242), (-72.95762, 41.324989), (-72.95764999999999, 41.324757), (-72.95752899999998, 41.324131), (-72.957401, 41.323256), (-72.957274, 41.322213), (-72.957234, 41.321676), (-72.957113, 41.32030199999999), (-72.95699, 41.319051), (-72.956998, 41.318629), (-72.956809, 41.316696), (-72.956767, 41.316354999999994), (-72.956711, 41.31575099999999), (-72.956587, 41.314509), (-72.956535, 41.314012), (-72.95640299999998, 41.313466), (-72.956164, 41.31252), (-72.95604699999998, 41.312096), (-72.956082, 41.311625), (-72.956101, 41.31137799999999), (-72.956111, 41.311101), (-72.956155, 41.310623), (-72.956276, 41.310455), (-72.956758, 41.310523), (-72.957228, 41.310567), (-72.958147, 41.310701), (-72.960629, 41.31076), (-72.961293, 41.310776), (-72.961776, 41.310801), (-72.963708, 41.310905), (-72.966561, 41.311225), (-72.968882, 41.311471), (-72.970176, 41.311613), (-72.972486, 41.311945), (-72.979858, 41.312539), (-72.982675, 41.312757999999995), (-72.986673, 41.3131), (-72.989148, 41.313297), (-72.99212, 41.313564), (-72.998048, 41.314097), (-72.997789, 41.31626)]]}, 'type': 'Feature', 'id': '4', 'properties': OrderedDict([(u'name', u'Westville'), (u'created_at', '2013-08-22'), (u'updated_at', '2013-08-22'), (u'cartodb_id', 7)])}
{'geometry': {'type': 'Polygon', 'coordinates': [[(-72.891374, 41.321845), (-72.891629, 41.322419), (-72.891236, 41.323526), (-72.890697, 41.324049), (-72.890364, 41.324372999999994), (-72.889471, 41.324999), (-72.889998, 41.326574), (-72.891693, 41.328471), (-72.892245, 41.32909699999999), (-72.892645, 41.330297), (-72.889645, 41.331397), (-72.888845, 41.332597), (-72.888147, 41.332594), (-72.885657, 41.333015), (-72.884937, 41.333166999999996), (-72.88413099999998, 41.333279), (-72.884049, 41.333286), (-72.883694, 41.333348), (-72.883229, 41.333464), (-72.882911, 41.333513999999994), (-72.881783, 41.33369299999999), (-72.879183, 41.334093), (-72.876482, 41.334009), (-72.876107, 41.334001), (-72.869661, 41.334831), (-72.86620499999998, 41.33601), (-72.86429, 41.336136), (-72.863288, 41.336017), (-72.860309, 41.336639), (-72.86082099999999, 41.335431), (-72.862185, 41.332478), (-72.862585, 41.331574), (-72.863129, 41.330206), (-72.86424399999999, 41.327498), (-72.86465, 41.32674), (-72.865702, 41.324775), (-72.866054, 41.324147), (-72.866278, 41.323708), (-72.866532, 41.323099), (-72.867184, 41.321618), (-72.867271, 41.32122), (-72.867309, 41.320992999999994), (-72.867369, 41.320882), (-72.867571, 41.320433), (-72.868718, 41.320241), (-72.869364, 41.320154), (-72.869759, 41.320117), (-72.869936, 41.320107), (-72.870526, 41.320107), (-72.87105, 41.320145), (-72.871187, 41.320166), (-72.871687, 41.320241), (-72.872063, 41.320317), (-72.87334, 41.320659), (-72.873682, 41.320783), (-72.874003, 41.320885), (-72.87464599999998, 41.31982599999999), (-72.874824, 41.319593), (-72.876103, 41.317684), (-72.876412, 41.317205), (-72.876723, 41.316787999999995), (-72.877226, 41.316046), (-72.87728299999999, 41.315958), (-72.87866899999999, 41.313867), (-72.87897799999999, 41.313525), (-72.87949599999999, 41.313011), (-72.87994, 41.312573), (-72.884836, 41.30941), (-72.886242, 41.308242), (-72.887869, 41.308973), (-72.88709, 41.310358), (-72.885151, 41.312207), (-72.884888, 41.312921), (-72.884754, 41.313537999999994), (-72.885029, 41.31562399999999), (-72.884799, 41.316393), (-72.884161, 41.317431), (-72.88430499999998, 41.31791499999999), (-72.884811, 41.318474), (-72.886012, 41.31872), (-72.886364, 41.319139), (-72.887279, 41.319741), (-72.889258, 41.320276), (-72.889951, 41.320718), (-72.890299, 41.320984), (-72.891374, 41.321845)]]}, 'type': 'Feature', 'id': '5', 'properties': OrderedDict([(u'name', u'Quinnipiac'), (u'created_at', '2013-08-22'), (u'updated_at', '2013-08-22'), (u'cartodb_id', 11)])}
{'geometry': {'type': 'Polygon', 'coordinates': [[(-72.906347, 41.290004), (-72.905548, 41.289984), (-72.905239, 41.293173), (-72.905491, 41.293544), (-72.905291, 41.29391499999999), (-72.904228, 41.296142), (-72.903602, 41.29720799999999), (-72.905177, 41.298271), (-72.90462999999998, 41.299014), (-72.904491, 41.29923), (-72.904081, 41.299234), (-72.903137, 41.29924499999999), (-72.896658, 41.301043), (-72.893217, 41.302055), (-72.892921, 41.30208), (-72.892552, 41.301489), (-72.892263, 41.301019999999994), (-72.892158, 41.300854), (-72.892043, 41.300724), (-72.891826, 41.300628999999994), (-72.891157, 41.300368), (-72.890252, 41.300063), (-72.89014999999999, 41.299899), (-72.889846, 41.29941), (-72.889769, 41.299235), (-72.889618, 41.299265), (-72.889686, 41.29876899999999), (-72.889617, 41.29857), (-72.889236, 41.298139), (-72.888935, 41.29794799999999), (-72.887883, 41.29728), (-72.88478399999998, 41.294931), (-72.882517, 41.29323), (-72.883851, 41.291566), (-72.885174, 41.289885999999996), (-72.885795, 41.289138), (-72.886269, 41.288453), (-72.88629499999999, 41.288358), (-72.886363, 41.288304), (-72.886439, 41.288062), (-72.886532, 41.28792), (-72.887706, 41.285709), (-72.88775, 41.285564), (-72.88755799999998, 41.284722), (-72.88755399999998, 41.283466), (-72.887456, 41.282545), (-72.887432, 41.282315), (-72.88794, 41.281725), (-72.888026, 41.281604), (-72.888135, 41.281552), (-72.888317, 41.2816), (-72.888525, 41.281653), (-72.888696, 41.28172), (-72.888938, 41.28182799999999), (-72.889638, 41.282156), (-72.890167, 41.282372), (-72.890138, 41.282042), (-72.89002099999999, 41.280712), (-72.890014, 41.280624), (-72.89002499999998, 41.279859), (-72.891114, 41.279956), (-72.891339, 41.279982), (-72.892239, 41.28009), (-72.893769, 41.280274), (-72.895042, 41.280486999999994), (-72.896298, 41.280717), (-72.897306, 41.280893), (-72.897558, 41.280937), (-72.897886, 41.280111), (-72.897965, 41.279903), (-72.899522, 41.280202), (-72.899402, 41.280802), (-72.898457, 41.281903), (-72.897366, 41.284402), (-72.89872999999999, 41.284401), (-72.90067699999999, 41.284102), (-72.900522, 41.282501), (-72.903832, 41.282000999999994), (-72.904007, 41.282701), (-72.905955, 41.2827), (-72.907189, 41.282605), (-72.906347, 41.290004)]]}, 'type': 'Feature', 'id': '6', 'properties': OrderedDict([(u'name', u'Annex'), (u'created_at', '2013-08-22'), (u'updated_at', '2013-08-22'), (u'cartodb_id', 15)])}
{'geometry': {'type': 'Polygon', 'coordinates': [[(-72.906674, 41.315539), (-72.906566, 41.31549299999999), (-72.904334, 41.316377), (-72.904262, 41.316094), (-72.904006, 41.314101), (-72.907169, 41.313482), (-72.907239, 41.313277), (-72.90779499999998, 41.312721), (-72.907819, 41.312483), (-72.907749, 41.311625), (-72.907739, 41.310653), (-72.907633, 41.310578), (-72.90774999999998, 41.309665), (-72.907749, 41.308787), (-72.908125, 41.308637), (-72.908134, 41.306045999999995), (-72.90691, 41.305337), (-72.90601599999998, 41.304993), (-72.906015, 41.304916), (-72.90563, 41.303493), (-72.904878, 41.300655), (-72.904491, 41.29923), (-72.905732, 41.300176), (-72.906163, 41.300505), (-72.906734, 41.300931), (-72.907016, 41.301155), (-72.907638, 41.30153), (-72.907921, 41.301669999999994), (-72.90857, 41.301896), (-72.90899, 41.30197799999999), (-72.909516, 41.302089), (-72.909931, 41.30214), (-72.910586, 41.302077), (-72.91133899999998, 41.301995), (-72.911907, 41.301902), (-72.912603, 41.301581999999996), (-72.91309, 41.301299), (-72.913815, 41.30068), (-72.914238, 41.300079), (-72.914551, 41.299774), (-72.914886, 41.299557), (-72.915642, 41.299362), (-72.916171, 41.29937799999999), (-72.916779, 41.299526), (-72.91727599999999, 41.29972299999999), (-72.92099799999998, 41.300885), (-72.920972, 41.300999), (-72.921055, 41.301296), (-72.920802, 41.301785), (-72.920602, 41.302292), (-72.920443, 41.302943), (-72.920269, 41.303866), (-72.919205, 41.307324), (-72.918726, 41.308964), (-72.91853099999999, 41.309900999999996), (-72.917207, 41.31076999999999), (-72.91617, 41.311498), (-72.914247, 41.312767), (-72.912043, 41.314147999999996), (-72.908268, 41.31657599999999), (-72.907848, 41.31667), (-72.907458, 41.316697), (-72.906164, 41.316613), (-72.90571, 41.316432), (-72.905991, 41.316158), (-72.90669999999999, 41.31583799999999), (-72.906761, 41.31562399999999), (-72.906674, 41.315539)]]}, 'type': 'Feature', 'id': '7', 'properties': OrderedDict([(u'name', u'Wooster Square/Mill River'), (u'created_at', '2013-08-22'), (u'updated_at', '2013-08-22'), (u'cartodb_id', 26)])}
{'geometry': {'type': 'Polygon', 'coordinates': [[(-72.952005, 41.294466), (-72.950793, 41.295846), (-72.9499, 41.29595199999999), (-72.949874, 41.296193), (-72.951085, 41.297262), (-72.950545, 41.297302), (-72.949576, 41.297398), (-72.948965, 41.297455), (-72.948907, 41.29747199999999), (-72.94886, 41.29755), (-72.94773099999999, 41.298054), (-72.947622, 41.297961), (-72.94751199999999, 41.298036), (-72.947315, 41.298192), (-72.943541, 41.300316), (-72.943211, 41.300515), (-72.944337, 41.302535), (-72.94447, 41.302773), (-72.94461699999998, 41.303035), (-72.945533, 41.303972), (-72.946165, 41.304639), (-72.94677899999999, 41.305321), (-72.9469, 41.305603), (-72.946922, 41.305889), (-72.945812, 41.305934), (-72.944772, 41.305957), (-72.943907, 41.305978), (-72.943674, 41.30600199999999), (-72.94361199999999, 41.30600299999999), (-72.942632, 41.306028), (-72.941559, 41.30607), (-72.940609, 41.306067), (-72.940361, 41.30608899999999), (-72.939476, 41.306136), (-72.939077, 41.306157), (-72.938652, 41.306165), (-72.93759499999999, 41.306074), (-72.937534, 41.306372), (-72.937441, 41.306592), (-72.937233, 41.306951), (-72.933731, 41.305558), (-72.932596, 41.305044), (-72.931407, 41.304324), (-72.931204, 41.303935), (-72.93103, 41.303852), (-72.929878, 41.30315), (-72.92927499999999, 41.30288399999999), (-72.928462, 41.302458), (-72.926886, 41.301607), (-72.92611199999999, 41.301269), (-72.925568, 41.301133), (-72.924349, 41.301102), (-72.924352, 41.300743), (-72.924783, 41.300101), (-72.92836999999999, 41.29621499999999), (-72.929732, 41.294814), (-72.92992399999999, 41.294699), (-72.931059, 41.294536), (-72.930859, 41.293632), (-72.93082, 41.293497), (-72.93052999999999, 41.292492), (-72.930488, 41.292347), (-72.9303, 41.291695), (-72.931051, 41.291556), (-72.930722, 41.290327), (-72.930645, 41.290084), (-72.930391, 41.289099), (-72.93001199999999, 41.287944), (-72.929692, 41.286691), (-72.92932399999998, 41.285479), (-72.930666, 41.285262), (-72.93053399999998, 41.284616), (-72.930334, 41.28399399999999), (-72.929025, 41.284202), (-72.928942, 41.284132), (-72.928655, 41.283023), (-72.927795, 41.283167), (-72.927264, 41.28325), (-72.926917, 41.283308), (-72.925715, 41.282939), (-72.926461, 41.282695999999994), (-72.928025, 41.281813), (-72.929395, 41.281078), (-72.929526, 41.280882), (-72.929069, 41.280343), (-72.929461, 41.280049999999996), (-72.929972, 41.28070099999999), (-72.930415, 41.280611), (-72.930786, 41.280536), (-72.931762, 41.280243), (-72.93259, 41.280136999999996), (-72.932989, 41.280198), (-72.933097, 41.280376), (-72.932892, 41.280939), (-72.93278199999999, 41.28156), (-72.933873, 41.281991), (-72.935723, 41.281687), (-72.93589999999999, 41.28167), (-72.936507, 41.281657), (-72.936578, 41.28167), (-72.936702, 41.28176), (-72.93712399999998, 41.28187), (-72.937304, 41.281921), (-72.937433, 41.281927), (-72.9375, 41.28191799999999), (-72.93754, 41.2819), (-72.937688, 41.2818), (-72.937775, 41.281773), (-72.93797, 41.28176), (-72.93815599999999, 41.2818), (-72.938249, 41.281515), (-72.938477, 41.281032), (-72.938901, 41.28141), (-72.93914, 41.281816), (-72.939403, 41.282395), (-72.93968099999998, 41.283008), (-72.939927, 41.283549), (-72.940549, 41.285356), (-72.940745, 41.285993), (-72.940648, 41.286698), (-72.939946, 41.287212), (-72.940092, 41.28758), (-72.94021, 41.287776), (-72.94153599999999, 41.288612), (-72.94293, 41.289007), (-72.943143, 41.289243), (-72.94370199999999, 41.289862), (-72.94517799999998, 41.291076), (-72.945988, 41.291742), (-72.946311, 41.292007999999996), (-72.946514, 41.292891), (-72.946875, 41.293003), (-72.94721499999999, 41.292983), (-72.94792, 41.292064), (-72.94953, 41.292955), (-72.949741, 41.293027), (-72.949872, 41.292998), (-72.95011999999998, 41.293178), (-72.95026, 41.293392999999995), (-72.950704, 41.293593), (-72.95102499999999, 41.293738), (-72.951718, 41.29404999999999), (-72.952005, 41.294466)]]}, 'type': 'Feature', 'id': '8', 'properties': OrderedDict([(u'name', u'Hill'), (u'created_at', '2013-08-22'), (u'updated_at', '2013-08-22'), (u'cartodb_id', 20)])}
{'geometry': {'type': 'Polygon', 'coordinates': [[(-72.942364, 41.32899), (-72.941013, 41.329859), (-72.940853, 41.330017), (-72.94049, 41.330604), (-72.940389, 41.330967), (-72.940218, 41.331382), (-72.94001899999999, 41.331709), (-72.939702, 41.332035), (-72.939182, 41.3327), (-72.93915299999999, 41.333357), (-72.93911599999998, 41.333498), (-72.93915699999998, 41.334139), (-72.939233, 41.33528999999999), (-72.940647, 41.335397), (-72.940556, 41.335834), (-72.939573, 41.33574), (-72.937913, 41.335621), (-72.937177, 41.335625), (-72.936317, 41.335547), (-72.93552, 41.335494), (-72.935189, 41.33533), (-72.933859, 41.33521), (-72.931693, 41.335014), (-72.930414, 41.334888), (-72.929254, 41.334771999999994), (-72.928127, 41.334695), (-72.926977, 41.334574), (-72.92489599999999, 41.334493), (-72.924929, 41.333924), (-72.924947, 41.33371), (-72.925003, 41.333071), (-72.925062, 41.332754), (-72.925221, 41.332345999999994), (-72.92550599999998, 41.33148099999999), (-72.925674, 41.330987), (-72.925814, 41.330666), (-72.926208, 41.329624), (-72.926323, 41.329294), (-72.926361, 41.32918399999999), (-72.92654399999999, 41.328790999999995), (-72.92689399999999, 41.32784199999999), (-72.927087, 41.327292), (-72.92709, 41.327283), (-72.92710699999999, 41.327239), (-72.927391, 41.326491), (-72.927718, 41.325597), (-72.929311, 41.32199399999999), (-72.929332, 41.321824), (-72.929246, 41.321497), (-72.929674, 41.321545), (-72.930178, 41.32162), (-72.930628, 41.321733), (-72.934552, 41.32264099999999), (-72.934635, 41.322645), (-72.934947, 41.322697), (-72.935066, 41.322745), (-72.935278, 41.322675), (-72.935288, 41.322875), (-72.937891, 41.322965), (-72.93844, 41.323037), (-72.938606, 41.323079), (-72.938926, 41.323258), (-72.939525, 41.323559), (-72.93976299999999, 41.323623), (-72.940299, 41.32359199999999), (-72.940525, 41.323547), (-72.94084399999998, 41.324551), (-72.940856, 41.324939), (-72.940859, 41.325071), (-72.940838, 41.325522), (-72.940787, 41.325797), (-72.940776, 41.326199), (-72.940858, 41.32658399999999), (-72.940938, 41.326954), (-72.940954, 41.326994), (-72.941232, 41.327652), (-72.941443, 41.327998), (-72.94179599999998, 41.328444999999995), (-72.942248, 41.32888299999999), (-72.942364, 41.32899)]]}, 'type': 'Feature', 'id': '9', 'properties': OrderedDict([(u'name', u'Newhallville'), (u'created_at', '2013-08-22'), (u'updated_at', '2013-08-22'), (u'cartodb_id', 32)])}
{'geometry': {'type': 'Polygon', 'coordinates': [[(-72.972561, 41.347525), (-72.968329, 41.347975), (-72.967832, 41.347906), (-72.967669, 41.347284), (-72.967583, 41.346767), (-72.96683999999999, 41.345435), (-72.966376, 41.345087), (-72.965767, 41.344617), (-72.964951, 41.344080999999996), (-72.96446, 41.343788), (-72.964417, 41.34417599999999), (-72.96429, 41.34534099999999), (-72.964187, 41.346419), (-72.963701, 41.346463), (-72.96332299999999, 41.34651499999999), (-72.963124, 41.346503), (-72.962787, 41.346281), (-72.96206, 41.34629699999999), (-72.96198599999998, 41.346744), (-72.96185499999999, 41.347215), (-72.961598, 41.347919), (-72.961426, 41.348538), (-72.96125499999998, 41.349007), (-72.959643, 41.34905), (-72.958643, 41.349079), (-72.958412, 41.349526), (-72.957745, 41.35039), (-72.957168, 41.350353), (-72.955697, 41.350262), (-72.955261, 41.350235), (-72.95466899999998, 41.350162), (-72.952808, 41.349078), (-72.953915, 41.347415), (-72.95364, 41.347215), (-72.95335899999999, 41.347492), (-72.953122, 41.347605), (-72.952939, 41.34757), (-72.952831, 41.347575), (-72.952406, 41.347574), (-72.951482, 41.347107), (-72.951525, 41.346453), (-72.951454, 41.345458), (-72.951358, 41.343947), (-72.952867, 41.343793), (-72.953603, 41.343322), (-72.954088, 41.343045999999994), (-72.954478, 41.342789), (-72.95518, 41.342346), (-72.955211, 41.341836), (-72.955489, 41.341436), (-72.95591599999999, 41.340913), (-72.956091, 41.340757), (-72.956377, 41.340683), (-72.956775, 41.340698), (-72.95717099999999, 41.340257), (-72.956991, 41.339847), (-72.955556, 41.338665999999996), (-72.953974, 41.337365999999996), (-72.951794, 41.337117), (-72.951042, 41.33706), (-72.948273, 41.336736), (-72.946848, 41.336597), (-72.943109, 41.336266), (-72.944968, 41.335384), (-72.947491, 41.334231), (-72.948764, 41.33365), (-72.949001, 41.333437), (-72.94907399999998, 41.333099), (-72.94915, 41.332812), (-72.949185, 41.33281), (-72.949732, 41.331464), (-72.950053, 41.330846), (-72.951733, 41.32841), (-72.951919, 41.32823299999999), (-72.953085, 41.327559), (-72.953329, 41.327463), (-72.95435999999998, 41.32831699999999), (-72.954594, 41.328501), (-72.955198, 41.328804), (-72.955416, 41.328877999999996), (-72.956089, 41.328884), (-72.95981799999998, 41.327804), (-72.959999, 41.328140999999995), (-72.960187, 41.328427), (-72.960266, 41.328652), (-72.960612, 41.329395), (-72.96068599999998, 41.329502), (-72.960835, 41.329632), (-72.96117099999998, 41.329839), (-72.96163599999998, 41.330133999999994), (-72.961954, 41.330216), (-72.963004, 41.330324), (-72.964132, 41.330443), (-72.96551, 41.330392999999994), (-72.96566899999999, 41.330406), (-72.966391, 41.33069799999999), (-72.965836, 41.331345), (-72.96589, 41.331641), (-72.9662, 41.332238), (-72.966462, 41.332894), (-72.967158, 41.33489899999999), (-72.967946, 41.335978), (-72.968155, 41.335928), (-72.969072, 41.335713), (-72.96995199999999, 41.335502), (-72.970148, 41.335997), (-72.969858, 41.336044), (-72.969643, 41.336098), (-72.969279, 41.337345), (-72.969115, 41.338004), (-72.969228, 41.338268), (-72.969466, 41.338854), (-72.969948, 41.339673), (-72.970993, 41.340134), (-72.971314, 41.34083499999999), (-72.969642, 41.34152999999999), (-72.970186, 41.342897), (-72.970924, 41.34399), (-72.971876, 41.345597999999995), (-72.972909, 41.347396), (-72.972802, 41.347399), (-72.972561, 41.347525)]]}, 'type': 'Feature', 'id': '10', 'properties': OrderedDict([(u'name', u'West Rock'), (u'created_at', '2013-08-22'), (u'updated_at', '2013-08-22'), (u'cartodb_id', 21)])}
{'geometry': {'type': 'Polygon', 'coordinates': [[(-72.944581, 41.311311), (-72.94418299999998, 41.312335), (-72.943838, 41.313264), (-72.94343599999999, 41.314248), (-72.943121, 41.315022), (-72.942937, 41.315482), (-72.942412, 41.316657), (-72.941403, 41.316337), (-72.940208, 41.315913), (-72.939179, 41.31549199999999), (-72.938833, 41.315402999999996), (-72.936771, 41.314678), (-72.935793, 41.314329), (-72.935567, 41.31423), (-72.934898, 41.313944), (-72.934104, 41.313537), (-72.934087, 41.313527), (-72.934012, 41.31349), (-72.933466, 41.313213), (-72.933139, 41.31304), (-72.933058, 41.313001), (-72.9328, 41.312863), (-72.933034, 41.312556), (-72.934468, 41.310621), (-72.935553, 41.30929), (-72.935979, 41.308611), (-72.937233, 41.306951), (-72.937355, 41.306754), (-72.937534, 41.306372), (-72.937594, 41.30608999999999), (-72.937905, 41.306129999999996), (-72.938285, 41.306152), (-72.938652, 41.306165), (-72.939227, 41.306146), (-72.939119, 41.306426), (-72.938977, 41.30685), (-72.938888, 41.307031), (-72.93857, 41.307516), (-72.938043, 41.308237), (-72.938652, 41.308498), (-72.939017, 41.308608), (-72.939791, 41.308714), (-72.939242, 41.310139), (-72.94025, 41.310359), (-72.941432, 41.310588), (-72.941453, 41.31063999999999), (-72.941874, 41.310738), (-72.942595, 41.31090199999999), (-72.942625, 41.310908), (-72.94313, 41.310999), (-72.944581, 41.311311)]]}, 'type': 'Feature', 'id': '11', 'properties': OrderedDict([(u'name', u'Dwight'), (u'created_at', '2013-08-22'), (u'updated_at', '2013-08-22'), (u'cartodb_id', 24)])}
{'geometry': {'type': 'Polygon', 'coordinates': [[(-72.94154399999998, 41.318130999999994), (-72.940429, 41.31991099999999), (-72.941306, 41.320584), (-72.940688, 41.321859999999994), (-72.940476, 41.322405), (-72.940414, 41.322810999999994), (-72.940411, 41.32303099999999), (-72.940525, 41.323547), (-72.93976299999999, 41.323623), (-72.939525, 41.323559), (-72.938926, 41.323258), (-72.938606, 41.323079), (-72.937891, 41.322965), (-72.93587, 41.322884), (-72.935288, 41.322875), (-72.935284, 41.322714), (-72.935066, 41.322745), (-72.93494999999999, 41.322711), (-72.934552, 41.32264099999999), (-72.930628, 41.321733), (-72.930178, 41.32162), (-72.929735, 41.32155699999999), (-72.929246, 41.321497), (-72.928946, 41.321597), (-72.925892, 41.321348), (-72.925937, 41.320371), (-72.925955, 41.320063), (-72.925956, 41.319205), (-72.925866, 41.318208), (-72.925707, 41.316238), (-72.927243, 41.316136), (-72.926753, 41.315237), (-72.927202, 41.315294), (-72.928983, 41.315609), (-72.928982, 41.3156), (-72.928899, 41.31521), (-72.929988, 41.315047), (-72.932447, 41.313825), (-72.932347, 41.313225), (-72.932256, 41.312903), (-72.932127, 41.312825), (-72.932166, 41.312698), (-72.93234799999999, 41.312634), (-72.93252, 41.312652), (-72.932849, 41.312901), (-72.933058, 41.313001), (-72.933139, 41.31304), (-72.934012, 41.31349), (-72.934087, 41.313527), (-72.934097, 41.313554), (-72.934898, 41.313944), (-72.935567, 41.31423), (-72.93575, 41.314309), (-72.936771, 41.314678), (-72.938833, 41.315402999999996), (-72.93922, 41.315525), (-72.940208, 41.315913), (-72.941403, 41.316337), (-72.942412, 41.316657), (-72.94154399999998, 41.318130999999994)]]}, 'type': 'Feature', 'id': '12', 'properties': OrderedDict([(u'name', u'Dixwell'), (u'created_at', '2013-08-22'), (u'updated_at', '2013-08-22'), (u'cartodb_id', 25)])}
{'geometry': {'type': 'Polygon', 'coordinates': [[(-72.90556, 41.270556), (-72.90549199999998, 41.270661), (-72.905207, 41.271483), (-72.904463, 41.272614), (-72.903611, 41.273775), (-72.903352, 41.2741), (-72.903267, 41.274445), (-72.903217, 41.27524199999999), (-72.903464, 41.276896), (-72.903204, 41.277245), (-72.903171, 41.277608), (-72.903567, 41.278487999999996), (-72.904807, 41.280637), (-72.90505, 41.280794), (-72.905348, 41.2827), (-72.904007, 41.282701), (-72.903832, 41.282000999999994), (-72.900522, 41.282501), (-72.90067699999999, 41.284102), (-72.89872999999999, 41.284401), (-72.897366, 41.284402), (-72.898457, 41.281903), (-72.899402, 41.280802), (-72.899522, 41.280202), (-72.897965, 41.279903), (-72.897886, 41.280111), (-72.89756299999999, 41.280936), (-72.897306, 41.280893), (-72.896327, 41.280738), (-72.895042, 41.280486999999994), (-72.894787, 41.280444), (-72.893769, 41.280274), (-72.892239, 41.28009), (-72.891339, 41.279982), (-72.890896, 41.279936), (-72.89002499999998, 41.279859), (-72.890014, 41.280624), (-72.89002099999999, 41.280712), (-72.890138, 41.282042), (-72.890167, 41.282372), (-72.889638, 41.282156), (-72.888938, 41.28182799999999), (-72.888696, 41.28172), (-72.888525, 41.281653), (-72.888317, 41.2816), (-72.888135, 41.281552), (-72.888026, 41.281604), (-72.88794, 41.281725), (-72.887571, 41.282152), (-72.887432, 41.282315), (-72.887514, 41.280772), (-72.887649, 41.278854), (-72.887357, 41.27713), (-72.887386, 41.276449), (-72.887473, 41.27618), (-72.88737, 41.276061999999996), (-72.887309, 41.275536), (-72.887302, 41.275061), (-72.887319, 41.274752), (-72.88725299999999, 41.272352), (-72.887098, 41.255132), (-72.887063, 41.25491), (-72.886871, 41.254283), (-72.886832, 41.253924), (-72.887025, 41.253794), (-72.887144, 41.253571), (-72.887348, 41.253393), (-72.887239, 41.253121), (-72.887264, 41.252964), (-72.888041, 41.25221), (-72.889094, 41.251159), (-72.88916099999999, 41.251047), (-72.889364, 41.251019), (-72.889619, 41.25097999999999), (-72.889947, 41.251022999999996), (-72.890245, 41.251076), (-72.890617, 41.251124), (-72.890976, 41.251175), (-72.891354, 41.25119999999999), (-72.89148, 41.25115), (-72.891401, 41.25120199999999), (-72.891947, 41.250966), (-72.892373, 41.250586999999996), (-72.892555, 41.250363), (-72.89258599999998, 41.250184), (-72.892681, 41.249787), (-72.892763, 41.249692), (-72.892903, 41.24963999999999), (-72.893269, 41.249765), (-72.893776, 41.24995), (-72.894317, 41.249918), (-72.894689, 41.249865), (-72.894736, 41.249859), (-72.895027, 41.249735), (-72.895059, 41.249638999999995), (-72.89508, 41.249606), (-72.895213, 41.249284), (-72.89691799999999, 41.248485), (-72.897568, 41.248471), (-72.898838, 41.248747), (-72.899116, 41.248705), (-72.899202, 41.248697), (-72.899561, 41.248497), (-72.899787, 41.248274), (-72.899748, 41.247984), (-72.899609, 41.24773199999999), (-72.89941, 41.247501), (-72.8996, 41.247131), (-72.899863, 41.247028), (-72.899874, 41.246991), (-72.900225, 41.246801), (-72.900376, 41.246733), (-72.900682, 41.246513), (-72.90089999999998, 41.246442), (-72.901002, 41.246453), (-72.901235, 41.24686499999999), (-72.901903, 41.247107), (-72.902485, 41.247383), (-72.903292, 41.247694), (-72.90362699999999, 41.247744), (-72.903845, 41.247727999999995), (-72.904107, 41.247634), (-72.903903, 41.247958), (-72.903888, 41.248238), (-72.90407, 41.248666), (-72.904012, 41.24876), (-72.904121, 41.248985), (-72.90388, 41.249265), (-72.903989, 41.249879), (-72.903921, 41.250098), (-72.903883, 41.250926), (-72.903779, 41.251262), (-72.903603, 41.25161), (-72.903205, 41.25181), (-72.902907, 41.252043), (-72.902797, 41.252257), (-72.90276099999998, 41.252666), (-72.90281199999998, 41.252915), (-72.902186, 41.253264), (-72.901851, 41.253393), (-72.901771, 41.253494999999994), (-72.901175, 41.253988), (-72.901067, 41.25440699999999), (-72.900963, 41.254858), (-72.90065, 41.255361), (-72.900512, 41.255444999999995), (-72.90016299999999, 41.25544299999999), (-72.899996, 41.255368), (-72.899865, 41.255212), (-72.900351, 41.255347), (-72.900629, 41.255217), (-72.900744, 41.255092999999995), (-72.90080999999999, 41.25491), (-72.900665, 41.254577999999995), (-72.900574, 41.254506), (-72.900512, 41.254467), (-72.90042499999998, 41.25447), (-72.900025, 41.254598), (-72.899552, 41.254643), (-72.899247, 41.25492599999999), (-72.898955, 41.255137), (-72.898919, 41.255311999999996), (-72.898796, 41.255386), (-72.898506, 41.255265), (-72.89807499999999, 41.255427), (-72.897966, 41.255357999999994), (-72.897835, 41.255399999999995), (-72.897791, 41.255507), (-72.897588, 41.25557599999999), (-72.89742799999999, 41.255519), (-72.897137, 41.255595), (-72.89671, 41.255775), (-72.896595, 41.255341), (-72.895244, 41.255667), (-72.894796, 41.255733), (-72.894451, 41.255959999999995), (-72.894093, 41.256799), (-72.89366, 41.257455), (-72.89378, 41.2598), (-72.894856, 41.261821), (-72.895324, 41.262709), (-72.89612799999999, 41.263697), (-72.89742999999999, 41.26494), (-72.897924, 41.265179), (-72.898289, 41.265592), (-72.89890599999998, 41.26608), (-72.899037, 41.26623099999999), (-72.899174, 41.266696), (-72.899443, 41.26701299999999), (-72.90107199999998, 41.268123), (-72.901698, 41.268387), (-72.902189, 41.268776), (-72.902919, 41.269088999999994), (-72.903014, 41.269175999999995), (-72.903516, 41.269482999999994), (-72.904494, 41.269893), (-72.90570499999998, 41.270329), (-72.905727, 41.27046), (-72.90556, 41.270556)]]}, 'type': 'Feature', 'id': '13', 'properties': OrderedDict([(u'name', u'East Shore'), (u'created_at', '2013-08-22'), (u'updated_at', '2013-08-22'), (u'cartodb_id', 33)])}
{'geometry': {'type': 'Polygon', 'coordinates': [[(-72.931059, 41.294536), (-72.92992399999999, 41.294699), (-72.929732, 41.294814), (-72.92836999999999, 41.29621499999999), (-72.924783, 41.300101), (-72.924352, 41.300743), (-72.924349, 41.301102), (-72.923154, 41.301081), (-72.922102, 41.30106299999999), (-72.92155, 41.301037), (-72.921328, 41.300985), (-72.921028, 41.300864), (-72.919676, 41.300441), (-72.918152, 41.299969), (-72.917242, 41.299717), (-72.916624, 41.299481), (-72.916171, 41.29937799999999), (-72.915642, 41.299362), (-72.915443, 41.2994), (-72.914886, 41.299557), (-72.914551, 41.299774), (-72.914238, 41.300079), (-72.914085, 41.300301), (-72.913815, 41.30068), (-72.913655, 41.300837), (-72.91309, 41.301299), (-72.912603, 41.301581999999996), (-72.911907, 41.301902), (-72.91133899999998, 41.301995), (-72.909931, 41.30214), (-72.909516, 41.302089), (-72.908959, 41.301964), (-72.90857, 41.301896), (-72.907921, 41.301669999999994), (-72.90744299999999, 41.301432), (-72.906987, 41.301163), (-72.90677, 41.300955), (-72.906163, 41.300505), (-72.905732, 41.300176), (-72.904491, 41.29923), (-72.90462999999998, 41.299014), (-72.905177, 41.298271), (-72.905968, 41.298776), (-72.906486, 41.298271), (-72.907014, 41.297964), (-72.907532, 41.29778), (-72.908355, 41.297702), (-72.908386, 41.297498), (-72.908444, 41.297398), (-72.908671, 41.297308), (-72.908786, 41.297342), (-72.908849, 41.297429), (-72.909049, 41.29875), (-72.909983, 41.298703), (-72.910094, 41.297547), (-72.910325, 41.297547), (-72.910246, 41.297054), (-72.910726, 41.296784), (-72.911251, 41.296779), (-72.913022, 41.296721), (-72.914276, 41.296296999999996), (-72.914798, 41.296665), (-72.915254, 41.296592), (-72.916005, 41.295905), (-72.916396, 41.295293), (-72.916755, 41.294779), (-72.916788, 41.294483), (-72.917473, 41.29392), (-72.917668, 41.293577), (-72.918256, 41.292645), (-72.920017, 41.291298), (-72.921257, 41.290048), (-72.92282199999998, 41.28793999999999), (-72.923866, 41.28593), (-72.925853, 41.283527), (-72.926917, 41.283308), (-72.927264, 41.28325), (-72.928655, 41.283023), (-72.928942, 41.284132), (-72.929025, 41.284202), (-72.930334, 41.28399399999999), (-72.93053399999998, 41.284616), (-72.930666, 41.285262), (-72.92932399999998, 41.285479), (-72.929692, 41.286691), (-72.93001199999999, 41.287944), (-72.930391, 41.289099), (-72.930645, 41.290084), (-72.931051, 41.291556), (-72.9303, 41.291695), (-72.93036199999999, 41.291912), (-72.930488, 41.292347), (-72.93070799999998, 41.293122), (-72.93082, 41.293497), (-72.930899, 41.293812), (-72.931059, 41.294536)]]}, 'type': 'Feature', 'id': '14', 'properties': OrderedDict([(u'name', u'Long Wharf'), (u'created_at', '2013-08-22'), (u'updated_at', '2013-08-22'), (u'cartodb_id', 35)])}
{'geometry': {'type': 'Polygon', 'coordinates': [[(-72.987296, 41.33124), (-72.985015, 41.333017), (-72.98331, 41.337307), (-72.981273, 41.338376), (-72.98047, 41.338751), (-72.97872, 41.339426), (-72.977248, 41.339992), (-72.97684, 41.340297), (-72.974068, 41.341594), (-72.971382, 41.3425), (-72.970186, 41.342897), (-72.969642, 41.34152999999999), (-72.971314, 41.34083499999999), (-72.970993, 41.340134), (-72.96997, 41.339683), (-72.969466, 41.338854), (-72.969115, 41.338004), (-72.969643, 41.336098), (-72.970148, 41.335997), (-72.96995199999999, 41.335502), (-72.969072, 41.335713), (-72.968155, 41.335928), (-72.967946, 41.335978), (-72.967155, 41.334897), (-72.966462, 41.332894), (-72.96625, 41.332378), (-72.96589, 41.331641), (-72.965843, 41.331355), (-72.966391, 41.33069799999999), (-72.966173, 41.330602), (-72.96577, 41.330427), (-72.96566899999999, 41.330406), (-72.964212, 41.330434), (-72.964231, 41.330287), (-72.964356, 41.329973), (-72.964815, 41.329285), (-72.96500999999999, 41.328844), (-72.965246, 41.328853), (-72.965234, 41.327919), (-72.96523, 41.326874), (-72.968203, 41.327256), (-72.968481, 41.327296), (-72.968714, 41.327296), (-72.969148, 41.32732099999999), (-72.969492, 41.327351), (-72.969732, 41.32732099999999), (-72.96998, 41.327311), (-72.97025, 41.327296), (-72.970549, 41.32727499999999), (-72.97156299999999, 41.32723299999999), (-72.97213, 41.327183999999995), (-72.972672, 41.327167), (-72.97303499999998, 41.327178), (-72.973141, 41.327195), (-72.973337, 41.32723399999999), (-72.97350599999999, 41.327273), (-72.974305, 41.327484), (-72.976076, 41.328026), (-72.978965, 41.32883799999999), (-72.979878, 41.329061), (-72.980256, 41.329169), (-72.982699, 41.329809), (-72.985013, 41.330421), (-72.987296, 41.33124)]]}, 'type': 'Feature', 'id': '15', 'properties': OrderedDict([(u'name', u'Amity'), (u'created_at', '2013-08-22'), (u'updated_at', '2013-08-22'), (u'cartodb_id', 38)])}
{'geometry': {'type': 'Polygon', 'coordinates': [[(-72.892921, 41.30208), (-72.891735, 41.302482), (-72.89086, 41.303546), (-72.887869, 41.308973), (-72.886242, 41.308242), (-72.884836, 41.30941), (-72.88246, 41.31094099999999), (-72.881878, 41.311342), (-72.87994, 41.312573), (-72.87897799999999, 41.313525), (-72.87866899999999, 41.313867), (-72.877602, 41.315467), (-72.877226, 41.316046), (-72.876723, 41.316787999999995), (-72.876412, 41.317205), (-72.876156, 41.317623), (-72.875113, 41.319167), (-72.87464599999998, 41.31982599999999), (-72.874003, 41.320885), (-72.87342799999999, 41.320699), (-72.872063, 41.320317), (-72.871687, 41.320241), (-72.871187, 41.320166), (-72.87105, 41.320145), (-72.870526, 41.320107), (-72.869936, 41.320107), (-72.869759, 41.320117), (-72.869364, 41.320154), (-72.868718, 41.320241), (-72.867571, 41.320433), (-72.867602, 41.320297), (-72.86773, 41.319753), (-72.869423, 41.315679), (-72.870739, 41.312862), (-72.872283, 41.309626), (-72.87243099999999, 41.308794), (-72.873511, 41.307153), (-72.87364, 41.306847), (-72.876949, 41.30274), (-72.877761, 41.30163199999999), (-72.878122, 41.301143), (-72.879835, 41.298099), (-72.880711, 41.29651499999999), (-72.882517, 41.29323), (-72.884364, 41.294639), (-72.887883, 41.29728), (-72.888935, 41.29794799999999), (-72.889213, 41.29812199999999), (-72.889485, 41.2984), (-72.889667, 41.298671), (-72.889686, 41.29876899999999), (-72.889618, 41.299265), (-72.889769, 41.299235), (-72.889846, 41.29941), (-72.890252, 41.300063), (-72.891157, 41.300368), (-72.891993, 41.300694), (-72.892153, 41.30084599999999), (-72.892552, 41.301489), (-72.892921, 41.30208)]]}, 'type': 'Feature', 'id': '16', 'properties': OrderedDict([(u'name', u'Fair Haven Heights'), (u'created_at', '2013-08-22'), (u'updated_at', '2013-08-22'), (u'cartodb_id', 41)])}
{'geometry': {'type': 'Polygon', 'coordinates': [[(-72.929332, 41.321824), (-72.929311, 41.32199399999999), (-72.927718, 41.325597), (-72.927391, 41.326491), (-72.927142, 41.327134), (-72.92709, 41.327283), (-72.927087, 41.327292), (-72.92689399999999, 41.32784199999999), (-72.926611, 41.328602), (-72.92654399999999, 41.328790999999995), (-72.926361, 41.32918399999999), (-72.926323, 41.329294), (-72.926208, 41.329624), (-72.925814, 41.330666), (-72.925674, 41.330987), (-72.92550599999998, 41.33148099999999), (-72.925221, 41.332345999999994), (-72.925098, 41.33263), (-72.925014, 41.332947), (-72.925003, 41.333071), (-72.924947, 41.33371), (-72.924929, 41.333924), (-72.92489599999999, 41.334493), (-72.920949, 41.334217), (-72.919963, 41.334149), (-72.919027, 41.334082), (-72.918763, 41.334063), (-72.918104, 41.333978), (-72.916466, 41.333901), (-72.913237, 41.333594), (-72.912529, 41.333192), (-72.912925, 41.332327), (-72.913086, 41.331999), (-72.913257, 41.331644), (-72.91328999999999, 41.331576), (-72.913621, 41.330819), (-72.913704, 41.330631), (-72.91394, 41.330087999999996), (-72.914136, 41.329671), (-72.91424399999998, 41.329431), (-72.914894, 41.328111), (-72.915789, 41.326158), (-72.916348, 41.324973), (-72.916488, 41.32467799999999), (-72.916879, 41.323826), (-72.91723299999998, 41.323046), (-72.917988, 41.321487), (-72.918431, 41.320571), (-72.918478, 41.320482), (-72.918906, 41.319638), (-72.923295, 41.320251999999996), (-72.923303, 41.32060299999999), (-72.923701, 41.320876), (-72.924267, 41.320947), (-72.925404, 41.321188), (-72.925892, 41.321348), (-72.928946, 41.321597), (-72.929246, 41.321497), (-72.929332, 41.321824)]]}, 'type': 'Feature', 'id': '17', 'properties': OrderedDict([(u'name', u'Prospect Hill'), (u'created_at', '2013-08-22'), (u'updated_at', '2013-08-22'), (u'cartodb_id', 51)])}
{'geometry': {'type': 'Polygon', 'coordinates': [[(-72.956938, 41.324974), (-72.956691, 41.325332), (-72.95613699999998, 41.3262), (-72.955907, 41.326434), (-72.95546, 41.326683), (-72.954343, 41.327085), (-72.95335899999999, 41.327473), (-72.95209, 41.32815), (-72.951733, 41.32841), (-72.95176399999998, 41.328422), (-72.951574, 41.328556), (-72.95141, 41.328923), (-72.950135, 41.330815), (-72.949712, 41.331483), (-72.949606, 41.331751), (-72.949309, 41.332509), (-72.94915, 41.332812), (-72.94912, 41.332936), (-72.94907399999998, 41.333099), (-72.949001, 41.333437), (-72.94874, 41.33366), (-72.9476, 41.334163999999994), (-72.945289, 41.335226), (-72.944479, 41.335564), (-72.943484, 41.336078), (-72.943109, 41.336266), (-72.942333, 41.336177), (-72.9416, 41.336063), (-72.940745, 41.335931), (-72.940538, 41.33589899999999), (-72.940647, 41.335397), (-72.939233, 41.33528999999999), (-72.939169, 41.334496), (-72.939114, 41.333421), (-72.93915299999999, 41.33334099999999), (-72.939165, 41.332859), (-72.939182, 41.3327), (-72.939702, 41.332035), (-72.94001899999999, 41.331709), (-72.940264, 41.33130899999999), (-72.94049, 41.330604), (-72.940853, 41.330017), (-72.941013, 41.329859), (-72.941649, 41.329426), (-72.942364, 41.32899), (-72.941905, 41.328558), (-72.941443, 41.327998), (-72.941232, 41.327652), (-72.940954, 41.326994), (-72.940938, 41.326954), (-72.940858, 41.32658399999999), (-72.940768, 41.326158), (-72.940777, 41.325841999999994), (-72.940787, 41.325797), (-72.940838, 41.325522), (-72.940868, 41.325207), (-72.940868, 41.325026), (-72.940869, 41.32463299999999), (-72.940507, 41.323515), (-72.940439, 41.32315799999999), (-72.940427, 41.323059), (-72.94040799999999, 41.32285799999999), (-72.940414, 41.322810999999994), (-72.940476, 41.322405), (-72.940597, 41.322092), (-72.940813, 41.321605), (-72.941306, 41.320584), (-72.940429, 41.31991099999999), (-72.94154399999998, 41.318130999999994), (-72.942412, 41.316657), (-72.943551, 41.317046999999995), (-72.94452, 41.317406), (-72.945156, 41.31764), (-72.946006, 41.317985), (-72.947545, 41.318532), (-72.948658, 41.318897), (-72.949091, 41.319058), (-72.949343, 41.319247), (-72.949629, 41.319439), (-72.950735, 41.32022), (-72.950987, 41.320412), (-72.951813, 41.320981), (-72.952098, 41.321175), (-72.952668, 41.321595), (-72.952858, 41.321726), (-72.953112, 41.321916), (-72.953557, 41.322246), (-72.953731, 41.322367), (-72.954287, 41.322833), (-72.954694, 41.32321), (-72.955485, 41.323896999999995), (-72.95587499999999, 41.324251), (-72.95629, 41.324572), (-72.956419, 41.324652), (-72.956938, 41.324974)]]}, 'type': 'Feature', 'id': '18', 'properties': OrderedDict([(u'name', u'Beaver Hills'), (u'created_at', '2013-08-22'), (u'updated_at', '2013-08-22'), (u'cartodb_id', 52)])}
{'geometry': {'type': 'Polygon', 'coordinates': [[(-72.908134, 41.306045999999995), (-72.908125, 41.308637), (-72.907749, 41.308787), (-72.907764, 41.309658), (-72.907633, 41.310578), (-72.907739, 41.310653), (-72.907749, 41.311625), (-72.907808, 41.312303), (-72.90779499999998, 41.312721), (-72.907239, 41.313277), (-72.907169, 41.313482), (-72.904006, 41.314101), (-72.904262, 41.316094), (-72.904334, 41.316377), (-72.906566, 41.31549299999999), (-72.906761, 41.31562399999999), (-72.90669999999999, 41.31583799999999), (-72.905991, 41.316158), (-72.90571, 41.316476), (-72.906164, 41.316613), (-72.904584, 41.317505), (-72.89773299999999, 41.318845), (-72.893132, 41.320167), (-72.891001, 41.320711), (-72.890299, 41.320984), (-72.889951, 41.320718), (-72.889258, 41.320276), (-72.887279, 41.319741), (-72.886364, 41.319139), (-72.886012, 41.31872), (-72.884811, 41.318474), (-72.88430499999998, 41.31791499999999), (-72.884161, 41.317431), (-72.884799, 41.316393), (-72.885029, 41.31562399999999), (-72.884754, 41.313537999999994), (-72.884888, 41.312921), (-72.885151, 41.312207), (-72.88709, 41.310358), (-72.887869, 41.308973), (-72.89086, 41.303546), (-72.891735, 41.302482), (-72.892921, 41.30208), (-72.893217, 41.302055), (-72.897075, 41.300931), (-72.903137, 41.29924499999999), (-72.904491, 41.29923), (-72.90496599999999, 41.300959), (-72.905655, 41.303552), (-72.90601599999998, 41.304993), (-72.90691, 41.305337), (-72.908134, 41.306045999999995)]]}, 'type': 'Feature', 'id': '19', 'properties': OrderedDict([(u'name', u'Fair Haven'), (u'created_at', '2013-08-22'), (u'updated_at', '2013-08-22'), (u'cartodb_id', 53)])}

In [41]:
len(c)


Out[41]:
20

In [42]:
for i in c:
    pol = i
    geom = shape(pol['geometry'])
    geom

In [43]:
geom


Out[43]:

Now plot the shapefiles


In [118]:
#Based on code from Kelly Jordhal: 
#http://nbviewer.ipython.org/github/mqlaql/geospatial-data/blob/master/Geospatial-Data-with-Python.ipynb

def plot_polygon(ax, poly):
    a = np.asarray(poly.exterior)
    ax.add_patch(Polygon(a, facecolor='#46959E', alpha=0.3))
    ax.plot(a[:, 0], a[:, 1], color='black')

def plot_multipolygon(ax, geom):
    """ Can safely call with either Polygon or Multipolygon geometry
    """
    if geom.type == 'Polygon':
        plot_polygon(ax, geom)
    elif geom.type == 'MultiPolygon':
        for poly in geom.geoms:
            plot_polygon(ax, poly)

In [119]:
nhv_geom = defaultdict()
#colors = ['red', 'green', 'orange', 'brown', 'purple']

In [121]:
fig, ax = plt.subplots(figsize=(12,12))
for rec in c:
    #print(rec['geometry']['type'])
    hood = rec['properties']['name']
    nhv_geom[hood] = shape(rec['geometry'])
    plot_multipolygon(ax, nhv_geom[hood])

labels = ax.get_xticklabels() 
for label in labels: 
    label.set_rotation(90) 
ax.set_xlabel('Longitude')
ax.set_ylabel('Latitude')

ax.plot(scf_df.loc[0, 'lng'], scf_df.loc[0, 'lat'], 'o')


Out[121]:
[<matplotlib.lines.Line2D at 0x11b65e290>]

Read in issues and determine the region

In this section I will read determine the region each issue occurs in. First to read in the issues:


In [82]:
import nhrc2.backend.read_seeclickfix_api_to_csv as rscf

In [83]:
scf_cats = rscf.read_categories(readfile=True)

In [85]:
scf_df = rscf.read_issues(scf_cats, readfile=True)


SNOW RELATED 8516
Bins for Trash & Recycling 5743
Graffiti 122
Hangers 6215
Health Complaints 5185
Illegal Dumping 1250
Other 374
Other - city responsibility 3018
Parking Meter 372
Parking Violation/Abandoned Auto 121
Parks Request 126
Policing Issue 2626
Potholes 116
Public Space, Streets and Drains 1249
Private Property Issue 1251
Sidewalks and Curb damage 117
Signs / Bus Shelters / Pavement Markings 373
Street Lamp 124
Traffic/Road Safety 2625
Traffic Signal / Pedestrian Signal 51
Trash & Recycling 1966
Tree Trimming 1853
Request for volunteers 5998
General Bus Request/Incident 4947
Post to Neighbors other

In [173]:
len(scf_cats)


Out[173]:
25

In [88]:
scf_df.head(3)


Out[88]:
acknowledged_at address category closed_at created_at id issue_id lat lng reporter_id reporter_name reporter_role shortened_url status summary updated_at int_issue_id
0 2015-03-30T16:03:33-04:00 25 Elmer Street New Haven, Connecticut SNOW RELATED None 2015-03-29T17:18:53-04:00 1559551 8516 41.310373 -72.924160 0 CAROL SANTACROCE Registered User http://bit.ly/1HVR8D7 Acknowledged SNOW RELATED 2015-03-30T16:03:33-04:00 8516
1 None Lenox Street And Clifton Street New Haven, Co... SNOW RELATED None 2015-03-17T12:04:30-04:00 1536264 8516 41.309046 -72.884204 6774 Department of Public Works Verified Official http://bit.ly/19w8mbW Open Unshoveled Sidewalks 2015-03-17T12:04:30-04:00 8516
2 None 591 Whitney Avenue New Haven, Connecticut SNOW RELATED None 2015-03-16T17:17:58-04:00 1534432 8516 41.326617 -72.915233 0 An anonymous SeeClickFix user Registered User http://bit.ly/1GeXnOd Open SNOW RELATED 2015-03-16T17:17:58-04:00 8516

In [89]:
len(scf_df)


Out[89]:
9080

Remove issues that do not have correct coordinates:


In [97]:
scf_df = scf_df[((scf_df['lat'] < 41.36) & (scf_df['lat'] > 41.24) & (scf_df['lng']>=-73.00) & (scf_df['lng'] <= -72.86))]
print(len(scf_df))


8076

In [98]:
scf_df.loc[0, 'lat']


Out[98]:
41.310372589942702

In [122]:
grid_point = Point(scf_df.loc[0, 'lng'], scf_df.loc[0, 'lat'])

In [159]:
for idx in range(5):
    grid_point = Point(scf_df.loc[idx, 'lng'], scf_df.loc[idx, 'lat']) 
    print('Point {} at {}'.format(idx, scf_df.loc[idx, 'address']))
    print('Downtown: {}'.format(grid_point.within(nhv_geom['Downtown'])))
    print('East Rock: {}'.format(grid_point.within(nhv_geom['East Rock'])))
    print('Fair Haven Heights: {}'.format(grid_point.within(nhv_geom['Fair Haven Heights'])))


Point 0 at 25 Elmer Street New Haven, Connecticut
Downtown: True
East Rock: False
Fair Haven Heights: False
Point 1 at Lenox Street And Clifton Street  New Haven, Connecticut
Downtown: False
East Rock: False
Fair Haven Heights: True
Point 2 at 591 Whitney Avenue New Haven, Connecticut
Downtown: False
East Rock: True
Fair Haven Heights: False
Point 3 at 900 Block Of State St New Haven, Connecticut
Downtown: False
East Rock: True
Fair Haven Heights: False
Point 4 at 112-116 Court Street New Haven, Connecticut
Downtown: True
East Rock: False
Fair Haven Heights: False

In [172]:
print('Number of neighborhoods: {}'.format(len(nhv_geom.keys())))
for hood in nhv_geom.keys():
    print(hood)


Number of neighborhoods: 20
Edgewood
Fair Haven Heights
Amity
Prospect Hill
West Rock
Beaver Hills
Quinnipiac
Wooster Square/Mill River
East Rock
Newhallville
Long Wharf
Downtown
West River
Westville
Dixwell
Annex
Fair Haven
Dwight
East Shore
Hill

In [168]:
def get_neighborhoods(scf_df, neighborhoods):
    hoods = []
    for idx in scf_df.index:
        grid_point = Point(scf_df.loc[idx, 'lng'], scf_df.loc[idx, 'lat']) 
        for hoodnum, hood in enumerate(nhv_geom.keys()):
            if grid_point.within(nhv_geom[hood]):
                hoods.append(hood)
                break
            if hoodnum == 19:
                #There are 20 neighborhoods. If you are the 20th (element 19 in 
                #zero-based indexing) and have not continued out of the iteration
                #set the neighborhood name to "Other":
                hoods.append('Other')
    return hoods

In [169]:
%time nbrhoods = get_neighborhoods(scf_df, nhv_geom)


CPU times: user 5 s, sys: 12.5 ms, total: 5.02 s
Wall time: 5.02 s

In [170]:
print(len(scf_df))
print(len(nbrhoods))


8076
8076

In [ ]: