سلام
من یک قطعه کد جاوا اسکریپت دارم به این شکل
var mapManager = {
map: null,
baseLayers: {},
overlays: {},
mapLayersMenu: null,
init: function (divID, center, zoom) {
// create base layers
// openstreetmap initialization
var mbUrl = 'http://10.1.2.113/osm_tiles/{z}/{x}/{y}.png';
//add polyline
var polylinePoints = [
new L.LatLng(35.6892, 51.3890),
new L.LatLng(35.6892, 51.3891),
new L.LatLng(35.6892, 51.3892),
new L.LatLng(35.6892, 51.3894),
new L.LatLng(35.6892, 51.3896),
new L.LatLng(35.6892, 51.3900),
new L.LatLng(35.6892, 51.3910),
new L.LatLng(35.6892, 51.3911),
new L.LatLng(35.6892, 51.3912),
new L.LatLng(35.6892, 51.3914),
new L.LatLng(35.6892, 51.4916),
new L.LatLng(35.6892, 51.4917),
new L.LatLng(35.6892, 51.4920)
];
var polylineOptions = {
color: 'blue',
weight: 6,
opacity: 0.9
};
var polyline = new L.Polyline(polylinePoints, polylineOptions);
// zoom the map to the polyline
var streets = L.tileLayer(mbUrl);
this.map = L.map(divID, {
center: center,
zoom: zoom,
layers: [streets, polyline, marker],
scrollWheelZoom: 'center'
});
this.baseLayers = {
"Streets": streets
};
},
}
چطور میتونم قسمت زیر رو از دیتا بیس بخونم و بفرستم روی این تابع در جاوا اسکریپت
var polylinePoints = [
new L.LatLng(35.6892, 51.3890),
new L.LatLng(35.6892, 51.3891),
new L.LatLng(35.6892, 51.3892),
new L.LatLng(35.6892, 51.3894),
new L.LatLng(35.6892, 51.3896),
new L.LatLng(35.6892, 51.3900),
new L.LatLng(35.6892, 51.3910),
new L.LatLng(35.6892, 51.3911),
new L.LatLng(35.6892, 51.3912),
new L.LatLng(35.6892, 51.3914),
new L.LatLng(35.6892, 51.4916),
new L.LatLng(35.6892, 51.4917),
new L.LatLng(35.6892, 51.4920)
];
از WebApi استفاده کنید
با فراخوانی اگر ContentType را روی Json بزارید به صورت لیستی از object ها کارااسکریپت بهتون تحویل میده
با ما تماس بگیرید تا در این مسیر همراهتان باشیم :)