Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.factual.data_science_toolkit;
 
 import  org.json.JSONException;
 import  org.json.JSONObject;
 
Represents a coordinate that came from a DataScienceToolkit query.

Author(s):
aaron
public class Coord {
  private final String region;
  private final String address;
  private final String locality;
  private final double latitude;
  private final double longitude;
  private final String country;
  private final double confidence;

  
Constructs a Coord from , which is expected to be a marshalled JSON object from a DataScienceToolkit query for a coord.

Example in:

 {"region":"CA",
  "street_name":"Chalon Rd",
  "country_code3":"USA",
  "locality":"Los Angeles",
  "street_number":"12001",
  "longitude":-118.480875,
  "latitude":34.08179,
  "confidence":0.61,
  "street_address":"12001 Chalon Rd",
  "country_code":"US",
  "fips_county":"06037",
  "country_name":"United States"}
 
  public Coord(JSONObject in) {
    try {
       = in.getString("region");
       = in.getString("street_address");
       = in.getString("locality");
       = in.getDouble("latitude");
       = in.getDouble("longitude");
       = in.getString("country_code");
       = in.getDouble("confidence");
    } catch (JSONException e) {
      throw new FactualApiException(e);
    }
  }
  public String getRegion() {
    return ;
  }
  public String getAddress() {
    return ;
  }
  public String getLocality() {
    return ;
  }
  public double getLatitude() {
    return ;
  }
  public double getLongitude() {
    return ;
  }
  public String getCountry() {
    return ;
  }
  public double getConfidence() {
    return ;
  }
  public String toString() {
    return "[Coord: address=" +  + ", lat=" +  + ", lon=" +  + "]";
  }
New to GrepCode? Check out our FAQ X