Java: How does one get a Point object using getContextByAddress

7 views
Skip to first unread message

Michael Nagle

unread,
Nov 23, 2011, 8:10:20 PM11/23/11
to simp...@googlegroups.com
The Javadocs are extremely thin. My objective is simple, I want to get a Point given a physical address. There are no examples. What are the key value pairs associated with queryParams?
In essence, I just want to geocode given a physical address in Java

Michael Nagle

unread,
Nov 23, 2011, 10:23:37 PM11/23/11
to simp...@googlegroups.com
Nevermind...got it.

public static void callSimpleGeoContextAsynchronously (final SimpleGeoContextClient client, final String address) throws IOException {
client.getContextByAddress(address, null, new SimpleGeoCallback(){
public void onSuccess(String jsonResponse) {
try {
final JSONObject response = new JSONObject(jsonResponse);
final String queryStr = response.getString("query");
final JSONObject query = new JSONObject(queryStr);
System.out.println("latitude: " + query.getString("latitude"));
System.out.println("longitude: " + query.getString("longitude"));
System.exit(0);
} catch (JSONException e) {
e.printStackTrace();
}
}
Reply all
Reply to author
Forward
0 new messages