I've encountered a problem with finding the latitude and longitude along a given route using Google Maps DirectionsService. I have a JSON dataset containing latitude, longitude, and price details. My goal is to plot markers on the map and determine which points fall within the specified route, along with their corresponding prices. Below is the code snippet I'm currently using, any help would be greatly appreciated. Thank you!
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&libraries=places"></script>
<div class = 'map_div'>
<div id="map-canvas" style="float:left;width:100%;"></div>
</div>
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script>
var toll_details = '[{"id":"1","latitude":"-23.413133333","longitude":"-46.36105","price":"4.2"}, ... // Rest of the JSON data here
});
}
finding(all_tolls)
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
<style>
html, body, #map-canvas {
height: 100%;
margin: 0px;
padding: 0px
}
.map_div {
border: 1px solid #CCCCCC;
border-radius: 4px;
float: left;
height: 500px;
margin-left: 4px;
margin-top: 10px;
padding: 10px;
width: 700px;
}
</style>