Exemplo n.º 1
0
    else:
      po_city = town_name
      po_zip_code = zip_code

  if town_name == "Rowe" and street == "34 BROADWAY":
    street = "321 Zoar Road"

  hours = hours_re.findall(town)[0]

  #This matches the towns to counties to acquire accurate FIPS.

  print "___________________"
  base_url = "http://maps.google.com/maps/api/geocode/json?sensor=false&address=%s"

  if street:
    fips, county_name = dogcatcher.map_fips(city, address_state, zip_code)
  else:
    fips, county_name = dogcatcher.map_fips(po_city, po_state, po_zip_code)

  result.append([authority_name, first_name, last_name, town_name, fips,
  street, city, address_state, zip_code,
  po_street, po_city, po_state, po_zip_code,
  reg_authority_name, reg_first, reg_last,
  reg_street, reg_city, reg_state, reg_zip_code,
  reg_po_street, reg_po_city, reg_po_state, reg_po_zip_code,
  reg_phone, reg_fax, reg_email, reg_website, reg_hours,
  phone, fax, email, website, hours, voter_state, source, review])

#This outputs the results to a separate text file.
dogcatcher.output(result, voter_state, cdir, "cities")
Exemplo n.º 2
0

    street = address.replace(po_street,"").replace(csz,"")
    street = street.replace("\n",", ").replace(" ,",",").strip(" \n/,").title()

    if po_street:
        po_city = city_re.findall(csz)[0].strip().title()
        po_state = state_re.findall(csz)[0].strip()
        po_zip_code = zip_re.findall(csz)[0].strip().title()
    if street:
        city = city_re.findall(csz)[0].strip().title()
        address_state = state_re.findall(csz)[0].strip()
        zip_code = zip_re.findall(csz)[0].strip().title()

    if street:
        fips, county_name = dogcatcher.map_fips(city, address_state, town_name, zip_code)
    else:
        fips, county_name = dogcatcher.map_fips(po_city, po_state, town_name, po_zip_code)

    result.append([authority_name, first_name, last_name, town_name, fips, county_name,
    street, city, address_state, zip_code,
    po_street, po_city, po_state, po_zip_code,
    reg_authority_name, reg_first, reg_last,
    reg_street, reg_city, reg_state, reg_zip_code,
    reg_po_street, reg_po_city, reg_po_state, reg_po_zip_code,
    reg_phone, reg_fax, reg_email, reg_website, reg_hours,
    phone, fax, email, website, hours, voter_state, source, review])

#This outputs the results to a separate text file.
dogcatcher.output(result, voter_state, cdir, "cities")
Exemplo n.º 3
0
	street = address.replace(po_street,"").replace(csz,"").replace("</b>","")
	street = " ".join(street.replace("<br />",", ").split()).strip(", ")

	if po_street:
		if street:
			city = city_re.findall(csz)[0].strip()
			address_state = state_re.findall(csz)[0].strip()
			zip_code = zip_re.findall(csz)[0].strip()
		po_city = city_re.findall(csz)[0].strip()
		po_state = state_re.findall(csz)[0].strip()
		po_zip_code = zip_re.findall(csz)[0].strip()
	else:
		city = city_re.findall(csz)[0].strip()
		address_state = state_re.findall(csz)[0].strip()
		zip_code = zip_re.findall(csz)[0].strip()


	fips, county_name = dogcatcher.map_fips(town_name, voter_state, zip_code)

	result.append([authority_name, first_name, last_name, town_name, county_name, fips,
	street, city, address_state, zip_code,
	po_street, po_city, po_state, po_zip_code,
	reg_authority_name, reg_first, reg_last,
	reg_street, reg_city, reg_state, reg_zip_code,
	reg_po_street, reg_po_city, reg_po_state, reg_po_zip_code,
	reg_phone, reg_fax, reg_email, reg_website, reg_hours,
	phone, fax, email, website, hours, voter_state, source, review])

#This outputs the results to a separate text file.
dogcatcher.output(result, voter_state, cdir)
Exemplo n.º 4
0
			reg_city = city_re.findall(reg_csz)[0].strip()
			reg_state = state_re.findall(reg_csz)[0].strip()
			reg_zip_code = zip_re.findall(reg_csz)[0].strip()
		if reg_po_street:
			reg_po_city = city_re.findall(reg_csz)[0].strip()
			reg_po_state = state_re.findall(reg_csz)[0].strip()
			reg_po_zip_code = zip_re.findall(reg_csz)[0].strip()

		reg_authority_name = "Municipal Registrar"

	print town_name

	try:

		if street:
			fips, county_name = dogcatcher.map_fips(town_name, "ME", zip_code, city)
		else:
			fips, county_name = dogcatcher.map_fips(town_name, "ME", po_zip_code, po_city)

	except: #Several towns don't work correctly in the Google Maps API.

		if town_name == "Magalloway Plantation" or town_name == "Lincoln Plantation":
			county_name = "Oxford"

		elif town_name == "Winterville Plantation":
			county_name = "Aroostook"

		else:
			print "There's a new broken town: " + town_name
			if street:
				print town_name + " ME " + zip_code
Exemplo n.º 5
0
            reg_city = city_re.findall(reg_csz)[0].strip()
            reg_state = state_re.findall(reg_csz)[0].strip()
            reg_zip_code = zip_re.findall(reg_csz)[0].strip()
        if reg_po_street:
            reg_po_city = city_re.findall(reg_csz)[0].strip()
            reg_po_state = state_re.findall(reg_csz)[0].strip()
            reg_po_zip_code = zip_re.findall(reg_csz)[0].strip()

        reg_authority_name = "Municipal Registrar"

    print town_name

    try:

        if street:
            fips, county_name = dogcatcher.map_fips(town_name, "ME", zip_code,
                                                    city)
        else:
            fips, county_name = dogcatcher.map_fips(town_name, "ME",
                                                    po_zip_code, po_city)

    except:  #Several towns don't work correctly in the Google Maps API.

        if town_name == "Magalloway Plantation" or town_name == "Lincoln Plantation":
            county_name = "Oxford"

        elif town_name == "Winterville Plantation":
            county_name = "Aroostook"

        else:
            print "There's a new broken town: " + town_name
            if street: