def osm_nominatim(DataLocation):
#    DataLocation = r'C:\Users\Wuga\Documents\DATASETS\SFREHPDATA\HousingSales2012.csv'
    geolocator=Nominatim()
    df=DO.readfile(DataLocation)
    print df
    df['Location'][:]=[x[0:x.find('#')] if x.find('#')!=-1 else x for x in df['Location']]
    print df
    complete=df['Location'][3]+" San Francisco"
    print complete
    longlat=geolocator.geocode(complete)
    print((longlat.latitude,longlat.longitude))
    transed=[]
    #transed=[geolocator.geocode(x+" San Francisco", timeout=None) for x in df['Location'][:5]]#need to sleep for a sec
    for x in df['Location'][:5]:
        transed.append(geolocator.geocode(x+" San Francisco", timeout=10))
        time.sleep(2)
    transed_la=[x.latitude if x is not None else 0 for x in transed]
    transed_lo=[x.longitude if x is not None else 0 for x in transed]
    cood_price=zip(df['Price'],transed_la,transed_lo)
    df_cood_price=pd.DataFrame(data=cood_price, columns=['Price','Latitude','Longitude'])
    df_cood_price.to_csv(Constants.filelocations.OSM_NOMINATIM_HOUSEPRICE, header= True, index=False)
    print df_cood_price
    return

    
def google_nominatim(DataLocation):
    df=DO.readfile(DataLocation)
    print df
    geolocator=geocoder.google('110 OTTER COVE TERRACE San Francisco')
    geolocator.latlng
    print geolocator.latlng
    transed=[]
    for x in df['Location']:
        transed.append(geocoder.google(x+" San Francisco", timeout=10).latlng)
        time.sleep(2)
    print transed
    nptransed=np.array(transed)
    transed_la = nptransed[:,0]
    transed_lo = nptransed[:,1]
    cood_price=zip(df['Price'],transed_la,transed_lo)
    df_cood_price=pd.DataFrame(data=cood_price, columns=['Price','Latitude','Longitude'])
    df_cood_price.to_csv(Constants.filelocations.GOOGLE_NOMINATIM_HOUSEPRICE, header= True, index=False)
    return