pub fn ll_to_address(lat: f64, lng: f64, conn: &PgConnection) -> Result<LocInfo> {
    let url_query = format!("https://reverse.geocoder.ls.hereapi.com/6.2/reversegeocode.json?prox={},{}&mode=retrieveAddresses&maxResults=1&gen=1&apiKey={}",
    lat,lng,
    env::var("GEOLOCATOR_API_KEY").expect("GEOLOCATOR_API_KEY env not set"));
    let mut resp = reqwest::get(&url_query)?;

    let resp_text: String = resp.text()?;

    let mut item: GeocoderResponseWrapper = serde_json::from_str(&resp_text)?;
    if item.response.view.is_empty() || item.response.view[0].result.is_empty() {
        error!("in getting geo locator data {:?}", item);
        error!("url_query: {}", url_query);
        return Err(Error::NotFound("geo locator data not found".to_string()));
    }

    let loc = item.response.view[0]
        .result
        .pop()
        .expect("ll_to_loc cannot get result");

    Ok(loc.location.address.expect("ll_to_loc cannot get address"))
}
/// Get location address from lat long
Get location address from lat long
Get location address from lat long
pub fn ll_to_address(lat: f64, lng: f64, conn: &PgConnection) -> Result<LocInfo> {
    let url_query = format!("https://reverse.geocoder.ls.hereapi.com/6.2/reversegeocode.json?prox={},{}&mode=retrieveAddresses&maxResults=1&gen=1&apiKey={}",
    lat,lng,
    env::var("GEOLOCATOR_API_KEY").expect("GEOLOCATOR_API_KEY env not set"));
    let mut resp = reqwest::get(&url_query)?;
    let resp_text: String = resp.text()?;
    let mut item: GeocoderResponseWrapper = serde_json::from_str(&resp_text)?;
    if item.response.view.is_empty() || item.response.view[0].result.is_empty() {
        error!("in getting geo locator data {:?}", item);
        error!("url_query: {}", url_query);
        return Err(Error::NotFound("geo locator data not found".to_string()));
    }
    let loc = item.response.view[0]
        .result
        .pop()
        .expect("ll_to_loc cannot get result");
    Ok(loc.location.address.expect("ll_to_loc cannot get address"))
}
pub fn ll_to_address ( lat : f64 , lng : f64 , conn : & PgConnection ) -> Result < LocInfo > { let url_query = format ! ( " " lat lng env var ( " " ) expect ( " " ) ) ; let mut resp = reqwest :: get ( & url_query ) ? ; let resp_text : String = resp . text ( ) ? ; let mut item : GeocoderResponseWrapper = serde_json :: from_str ( & resp_text ) ? ; if item . response . view . is_empty ( ) || item . response . view [ 0 ] . result . is_empty ( ) { error ! ( " " item ) ; error ! ( " " url_query ) ; return Err ( Error :: NotFound ( " " . to_string ( ) ) ) ; } let loc = item . response . view [ 0 ] . result . pop ( ) . expect ( " " ) ; Ok ( loc . location . address . expect ( " " ) ) }
Get location address from lat long
Get location address from lat long
lat
f64
lng
f64
conn
&PgConnection
lat
f64
lng
f64
conn
&PgConnection