Skip to content

Instantly share code, notes, and snippets.

@nazt
Created January 12, 2010 09:47
Show Gist options
  • Save nazt/275062 to your computer and use it in GitHub Desktop.
Save nazt/275062 to your computer and use it in GitHub Desktop.
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package NAzT;
import java.util.ArrayList;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
/**
*
* @author NAzT
*/
public class JGeoCoder {
ArrayList output = null;
public ArrayList getOutput() {
return output;
}
JGeoCoder(String location) {
GMapsGeoCoder geocoder = new GMapsGeoCoder();
geocoder.setQuery(location);
JSONObject json = JSONObject.fromObject(geocoder.getJsonObj());
JSONArray jsonArray = JSONArray.fromObject(json);
this.output = geocoder.getLatLon(jsonArray);
}
public static void main(String args[]) {
JGeoCoder myobj = new JGeoCoder("Thammasat Rangsit");
System.out.println(myobj.getOutput().get(0));
JGeoCoder myobj2 = new JGeoCoder("ธรรมศาสตร์ รังสิต");
System.out.println(myobj2.getOutput().get(0));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment