Example #1
0
 def next(self):
     item_dict = {
         'id': '',
         'kml_id': '',
         'bounds': '',
         'street_name': '',
         'borough_code': '',
         'zip_code': ''
     }
     item = self.itemsGen.next()
     try:
         item_dict['kml_id'] = item.name
         item_dict['bounds'] = item.geometry.bounds
         et = etree.fromstring('<root>' + item.description + '</root>')
         for li in et.findall('ul/li'):
             atrname = li.find(".//*[@class='atr-name']")
             if (atrname is not None):
                 atrval = li.find(".//*[@class='atr-value']")
                 if (atrname.text == "PHYSICALID"):
                     item_dict['id'] = atrval.text
                 elif (atrname.text == "STNAME_LAB"):
                     item_dict['street_name'] = atrval.text
                 elif (atrname.text == "BOROUGHCOD"):
                     item_dict['borough_code'] = atrval.text
                 elif (atrname.text == "L_ZIP"):
                     item_dict['zip_code'] = atrval.text
     except Exception:
         pass
     return item_dict
 def next(self):
     item_dict = {
             'id': '',
             'kml_id': '',
             'bounds': '',
             'street_name': '',
             'borough_code': '',
             'zip_code': ''}
     item = self.itemsGen.next()
     try:
         item_dict['kml_id'] = item.name
         item_dict['bounds'] = item.geometry.bounds
         et = etree.fromstring('<root>'+item.description+'</root>')
         for li in et.findall('ul/li'):
             atrname = li.find(".//*[@class='atr-name']")
             if (atrname is not None):
                 atrval = li.find(".//*[@class='atr-value']")
                 if (atrname.text == "PHYSICALID"):
                     item_dict['id'] = atrval.text
                 elif (atrname.text == "STNAME_LAB"):
                     item_dict['street_name'] = atrval.text
                 elif (atrname.text == "BOROUGHCOD"):
                     item_dict['borough_code'] = atrval.text
                 elif (atrname.text == "L_ZIP"):
                     item_dict['zip_code'] = atrval.text
     except Exception:
         pass
     return item_dict
Example #3
0
 def next(self):
     if self.i < len(self.trees):
         i = self.i
         self.i += 1
         tree = self.trees[i]
         tree_kml_id = tree.name.split('.')[1]
         tree_id = ''
         et = etree.fromstring('<root>'+tree.description+'</root>')
         for li in et.findall('ul/li'):
             atrname = li.find(".//*[@class='atr-name']")
             if (atrname is not None) and (atrname.text == "TREEID"):
                 atrval = li.find(".//*[@class='atr-value']")
                 tree_id = atrval.text
         tree_latlng = [tree.geometry.y,tree.geometry.x]
         tree_stateplane = CoordUtils.stateplane_for_latlng(tree_latlng)
         return {'id': tree_id,
             'kml_id': tree_kml_id,
             'stateplane': tree_stateplane,
             'latlng': tree_latlng}
     else:
         raise StopIteration()