jSOn TO MAp
Last Updated: Dec 11 2017 11:57, Started by
catalinio007
, Dec 11 2017 11:57
·
0
#1
Posted 11 December 2017 - 11:57
Salut,
Am nevoie si eu de putin ajutor. Am initializat o harta cu OpenLayers si un script ce imi returneaza o ruta sub forma de JSON, as dori ca acest jSon sa il afisez pe harta, practic sa il parsez eventual intr-un array cu latitudine si longitudine extrase si sa il afisez pe harta. Are cineva idee cum pot face asta ? Atasez si codul meu pana acum. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR...nsitional.dtd"> <html> <title>My jQuery JSON Web Page</title> <head> <link rel="stylesheet" href="C:\Users\adrian.avram\Desktop\testare\testdez\google.css" type="text/css"> <link rel="stylesheet" href="google.css" type="text/css"> <style type="text/css"> html, body, #map { margin: 0; width: 100%; height: 100%; } #text { position: absolute; bottom: 1em; left: 1em; width: 512px; z-index: 20000; background-color: white; padding: 0 0.5em 0.5em 0.5em; } </style> <script src="C:\Users\adrian.avram\Desktop\testare\testdez\OpenLayers.js"></script> <script type="text/javascript" src="https://ajax.googlea...n.js"></script> <script type="text/javascript"> $( document ).ready(function() { $.ajax({ url: 'https://route.api.he...ulateroute.json' type: 'POST', dataType: 'jsonp', jsonp: 'jsoncallback', data: { waypoint0: '39.2923,-76.6088', waypoint1: '39.2976,-76.5940', mode: 'fastest;car;traffic:enabled', limitedweight: '20', weightperaxle: '10', app_id: 'wHCqo9g0S9c4OTLEUzZf', app_code: 'dzWjjvh1aacaDZWJMAY_Dw', }, success: function (data) { alert(JSON.stringify(data)); } }); }); //Functie de calculare Ruta in functie de greutate vehicul </script> </head> <body> <h1>Harta Ruta</h1> <div id="map"></div> <script src="C:\Users\adrian.avram\Desktop\testare\testdez\fullScreen.js"></script> </body> </html> |
Anunturi
Bun venit pe Forumul Softpedia!
▶ 0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users