Home > OS >  How To Make Java Set A GPS On Google Maps With A Location 'A' And Location 'B'
How To Make Java Set A GPS On Google Maps With A Location 'A' And Location 'B'

Time:11-03

I Want To Make Java Open Up Google Maps And Type In To Set A GPS Between Location A (Start) And Location B (Destination). I Also Want To Make An Option Where Location A Can Use Your Location As The Start. Location A And B Will Be A Name Of A City Anywhere In The World ( In English )

I Tried Searching On The Internet About This But The Furthest I Got Was "How To Open A Website Using Java" And When That Worked I Had To Overide The Mouse And Keyboard And Then Type In To The Search..... And Much More Tedious Lines Of Code

CodePudding user response:

A basic way of doing this would be to construct a Google Maps URL yourself, and then open that. The basic format for Google Maps directions is:

https://www.google.com/maps/dir/starting address separated by plus signs/ending location/

You can replace the starting and ending addresses with whatever you want. So for example, if you want to show directions from Albany, NY to Los Angeles, CA, you would use the following:

https://www.google.com/maps/dir/Albany, New York/Los Angeles, California/

Try opening that in your browser and you will see it shows directions from Albany to Los Angeles!

  • Related