I am making a program to scrape the value of Elevation from a web page. The webpage address is - https://nationalmap.gov/epqs/pqs.php?x=35.227085&y=-80.843123&units=Meters&output=json
When we open the above link, the webpage displayed is -
{"USGS_Elevation_Point_Query_Service":{"Elevation_Query"{"x":35.227085,"y":-80.843123,"Data_Source":"3DEP 1/3 arc-second","Elevation":"-1000000","Units":"Meters"}}}
I am not able to print the value of only Elevation i.e, -1000000 from the data displayed on the webpage. I am required to do it using JAVA. Please help. I am new to programming.
I tried a code below. But is prints entire content of webpage. I require only elevation value.
URL url;
InputStream is = null;
BufferedReader br;
try {
url = new URL("https://nationalmap.gov/epqs/pqs.php?x=35.227085&y=-80.843124&units=Meters&output=json");
is = url.openStream(); // throws an IOException
br = new BufferedReader(new InputStreamReader(is));
// System.out.println (br.lines());
while ((line = br.readLine()) != null) {
System.out.println(line);
}
I want only the elevation value using JAVA.