开发者

How to embed google map API in MATLAB?

开发者 https://www.devze.com 2023-02-06 03:12 出处:网络
I want to embed google map api in my matlab application for finding shortest distance between two different location (co-ordinates). I tried to show poly line on it..

I want to embed google map api in my matlab application for finding shortest distance between two different location (co-ordinates). I tried to show poly line on it..

How can I achieve this in matla开发者_StackOverflow中文版b ?

Thanks Abhi


MATLAB can natively instantiate Java classes. Java itself has been enhanced in order to leverage scripting languages. How to Run Javascript on the JVM in Just Fifteen Minutes might be a valuable approach on using Google Map API from within MATLAB.


I believe the best way is to use google distance matrix api and urlread in matlab.

try this:

orig_coord = '37.869733350860730,-122.284758688533';
dest_coord = '37.871700000000000,-122.253300000000';
mode='walking';

url = ['https://maps.googleapis.com/maps/api/distancematrix/json?origins=(',orig_coord,')&destinations=(',dest_coord,')&mode=',mode,'&language=en-EN&sensor=false'];

str = urlread(url);

then you can use JSON Parser to decode.

0

精彩评论

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