Hi all,
I am trying to use the POST elevation API in Matlab. I succeeded with GET, but want to go deeper.
I have tried this, but it doesnt work:
url = 'https://api.openrouteservice.org/elevation/line';
hf = {'Accept','application/json, application/geo+json, application/gpx+xml, img/png; charset=utf-8';...
'Authorization','<api_key>';...
'Content-Type','application/json; charset=utf-8'};
options = weboptions('CharacterEncoding','utf-8','RequestMethod','POST',...
'HeaderFields',hf,'ArrayFormat','json','MediaType','application/json','ContentType','json');
Body = struct('format_in', 'polyline', ...
'format_out', 'polyline', ...
'dataset', 'srtm', ...
'geometry', '[[13.331302,38.108433],[13.331273,38.10849]]');
Body = struct('order', Body);
response = webwrite(url, Body, options);
But matlab gives the following error:
Error using readContentFromWebService (line 46)
The server returned the status 400 with message "Bad
Request" in response to the request to URL
https://api.openrouteservice.org/elevation/line.
Could anyone help? Thanks in advance.
Regards,
Thomas