i would like choice and change color to some streets by the my address table. i want to use ajax and json result and change the entire road of this address with different color.
no problem to use ajax and put markers by lat and long, but i don't know the method to change color of the street in this point (lat, long).
<html>
<head>
<title>Leaflet Polyline Example</title>
<link rel="stylesheet" href="leaflet/leaflet.css" />
<!--[if lte IE 8]><link rel="stylesheet" href="leaflet/leaflet.ie.css" /><![endif]-->
<script src="leaflet/leaflet.js"></script>
<script language="javascript">
function init() {
var map = new L.Map('map');
L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© <a href="http://openstreetmap.org">OpenStreetMap</a> contributors',
maxZoom: 18
}).addTo(map);
map.attributionControl.setPrefix(''); // Don't show the 'Powered by Leaflet' text.
//Define an array of Latlng objects (points along the line)
var polylinePoints = [
new L.LatLng(43.078271, 12.424237),
new L.LatLng(43.077759, 12.423706),
];
var polylineOptions = {
color: 'blue',
weight: 6,
opacity: 0.9
};
var polyline = new L.Polyline(polylinePoints, polylineOptions);
map.addLayer(polyline);
// zoom the map to the polyline
map.fitBounds(polyline.getBounds());
}
</script>
</head>
<body onLoad="javascript:init();">
<div id="map" style="height: 100%"></div>
</body>
</html>
this code design a line with list of different lat, long passed, but don't follow the street. I need different logic because i want color just only the street.