Microsoft is providing Bing maps API. To access this API, you need to register the application and get the key. See official documentation here.

Program Flow

  1. Form Get request to Bing Maps API server
  2. Get Response 
  3. Convert Response to Java Pojo Classes
  4. Use those Pojo classes for your own logic
Find the project at below link and execute file.

Get the key 

Register your application here, and get the key.

Form URL, UK&wp.2=Church St, Newcastle-under-Lyme, UK&key=Your-Applicattion-Key


  1. wp.1 - Give starting location address
  2. wp.2 - Give ending location address
  3. key - Give your application key
  4. o - Output format (xml, json)

Java Code

String from = "lynnwood";
String to ="seattle";
String key = "Paste your application key here";
URL url = new URL(""+from+"&wp.1="+to+"&avoid=minimizeTolls&key="+key);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
String line, outputString = "";
BufferedReader reader = new BufferedReader(
new InputStreamReader(conn.getInputStream()));
while ((line = reader.readLine()) != null) {
    outputString += line;
System.out.println("*********** JSON Response ***********");
System.out.println("*********** POJO Classes ***********");
DistancePojo capRes = new Gson().fromJson(outputString, DistancePojo.class);
System.out.println("*********** Distance ***********");
System.out.println(capRes.getResourceSets()[0].getResources()[0].getTravelDistance() + " km");


  1. I love this. It is soo informative. Are you also searching for cheap assignment help we are the best solution for you. We are best known for delivering the best services to students without having to break the bank

  2. I was not created for unnecessary trouble in studying, but it saves me that there is a samedayessay promo code, I recommend it, any written essay is written on it, and everything is written neatly, correctly



Popular Posts