Thanks for responding @amoncaldas , as I said I am new to ORS,
let request = new XMLHttpRequest();
request.open('POST', "https://api.openrouteservice.org/v2/directions/driving-car");
request.setRequestHeader('Accept', 'application/json, application/geo+json, application/gpx+xml, img/png; charset=utf-8');
request.setRequestHeader('Content-Type', 'application/json');
request.setRequestHeader('Authorization', 'key');
request.onreadystatechange = function () {
if (this.readyState === 4) {
console.log('Headers:', this.getAllResponseHeaders());
console.log('Body:', this.responseText);
var data = this.responseText;
var jsonResponse = JSON.parse(data);
}
};
const body = '{"coordinates":[[55.801281,37.573242],[115.663757,38.106467]]}';
I am using above code for distance and time calculation for given coordinates and I want to add below map to the field, which was successfully done.
frm.set_df_property('map','options','<div class="mapouter"><div class="canvas"><iframe width=100% height="300" id="canvas" src="https://maps.openrouteservice.org/#/directions/Ladenburg,Germany/Heidelberg,Germany/data/55,130,32,198,15,97,4,224,38,9,96,59,2,24,5,192,166,6,113,0,184,64,14,0,232,3,96,1,128,86,82,6,103,32,26,0,88,4,228,62,227,24,184,129,184,142,63,1,24,1,51,208,14,192,217,189,65,85,243,225,11,68,4,0,14,169,224,68,77,135,40,5,208,32,3,55,128,6,221,46,112,1,60,195,234,64,28,192,45,52,116,150,2,187,238,77,22,72,45,232,119,163,184,140,17,188,58,200,152,24,193,110,200,250,24,208,40,202,0,110,232,0,250,218,14,33,184,160,168,46,150,232,168,241,144,14,136,168,184,2,114,152,0,22,46,9,129,96,168,48,184,164,36,114,0,238,232,240,150,37,217,149,213,174,56,124,44,0,190,114,0,94,80,0,182,184,124,248,189,189,64,0/embed/en-us" frameborder="0" scrolling="no" marginheight="0" marginwidth="0"></iframe><br><style>.mapouter{position:relative;text-align:right;height:300px;width:100%;}</style><style>.canvas {overflow:hidden;background:none!important;height:300px;width:100%;}</style></div></div>');
frm.refresh_field('map');
Now please help me to use dynamic locations based on my coordinates for map.
Thank you