I am using the following website to find elevation:
This provides a results in the format of 93.7665481567383 in an XML format.
Anyone know of a quick and simple way of extracting this data for my android program?
I tried the following but I keep getting "null" as the output.
HttpURLConnection connection = null;
URL serverAddress = null;
serverAddress = new URL("http://gisdata.usgs.gov/xmlwebservices2/elevation_service.asmx/getElevation?X_Value=-78.85834070853889&Y_Value=43.869369104504585&Elevation_Units=METERS&Source_Layer=-1&Elevation_Only=true");
connection = null;
connection = (HttpURLConnection)serverAddress.openConnection();
connection.setRequestMethod("GET");
connection.setDoOutput(true);
connection.setReadTimeout(10000);
connection.connect();
BufferedReader rd = new BufferedReader(new
InputStreamReader(connection.getInputStream()));
StringBuilder sb = new StringBuilder();
String line = null;
line = rd.readLine();
while ((line = rd.readLine()) != null)
{
sb.append(line + '\n');
}
When i output sb.toString() i get Null
Any ideas?