Beispiel #1
0
					place, ( lat, lng ) = g.geocode( call[ "address" ] + " Springfield, MO",exactly_one=True )
				except:
					print "google geocode failed. trying yahoo"
					try:
						place, (lat,lng ) = y.geocode( call[ "address" ] + " Springfield, MO",exactly_one=True)
					except:
						print "yahoo geocode failed! trying geocoder.us"
						try:
							place, (lat,lng ) = us.geocode( call[ "address" ] + " Springfield, MO", exactly_one=True)
						except:
							print "Geocoder.us failed!!"
							
						else:
							print "using Geocoder.us lat/lng"
							geocoder_count += 1
							new_call.geocoder = "geocoder.us"
					else:
						print "using Yahoo lat/lng"
						yahoo_count += 1
						new_call.geocoder = "yahoo"
				else:
					print "using google lat/lng"
					google_count += 1
					new_call.geocoder = "google"
					
				if ( lng is not None or lng != "" ) and ( lat is not None or lng != "" ):
					try:
						new_call.geom = fromstr( 'POINT(' + str(lng) + " " + str(lat) +')', srid = 4326 )
					except:
						print "ERROR! setting the lat/lng for this call"
						new_call.geocoder = None