Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This is IntelliJ java. I have these codes, but I am getting a good result. Please them and assist me. This is the ket.txt =
This is IntelliJ java. I have these codes, but I am getting a good result. Please them and assist me.
This is the ket.txt = AIzaSyBqAZ-5zQLdifYl1y89DQjtyPBzXyqKdPU
package Mohamed.company; import com.google.maps.ElevationApi; import com.google.maps.GeoApiContext; import com.google.maps.GeocodingApi; import com.google.maps.model.ElevationResult; import com.google.maps.model.GeocodingResult; import com.google.maps.model.LatLng; import java.awt.image.BufferedImage; import java.io.BufferedReader; import java.io.FileReader; import java.util.Scanner; /** * Created by mash4 on 3/7/2017. */ public class googel_map { static Scanner sc = new Scanner(System.in); public static void main(String[] args) throws Exception { String key = null; try{ BufferedReader reader = new BufferedReader(new FileReader("key.txt")); key = reader.readLine(); } catch (Exception ioe){ System.out.println("No key found, or could n't read key. Please verify key.txt present "); System.exit(-1); } System.out.println("Please enter an address : "); GeoApiContext context = new GeoApiContext().setApiKey(key); String myAdrress = sc.nextLine(); GeocodingResult result [] = GeocodingApi.geocode(context, myAdrress).await(); LatLng r = (result[0].geometry.location); ElevationResult [] t = ElevationApi.getByPoints(context, r).await(); if(result.length >= 1){ ElevationResult addElevation = t[0]; System.out.println("The elevation of " + myAdrress + " above sea level is " + addElevation.elevation + " meters."); } } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started