开发者

Open Google Maps in Default Browser with Predetermined Start and End Points?

开发者 https://www.devze.com 2023-01-31 04:22 出处:网络
I\'m using Java and want to open Google Maps in my default browser with a predefined start and destination. I know how to open the home of google m开发者_StackOverflow社区aps in the browser but is the

I'm using Java and want to open Google Maps in my default browser with a predefined start and destination. I know how to open the home of google m开发者_StackOverflow社区aps in the browser but is there any easy (or any way at all) to have my program automatically input the start and ending addresses and then select the first choice?


Try creating a link to http://maps.google.com/maps?saddr=XX&daddr=XX, where saddr is the start address and daddr is the destination address. If you're using the address, make sure you URL-encode the values. You can also use latitude/longitude coordinate pairs as parameters by putting @ in front of them, like http://maps.google.com/maps?saddr=@lat,long&daddr=XX.


The URL seems to have been covered by Soemoe Aung. As for the 'open in default browser' part, see Desktop.browse(URI).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号