【发布时间】:2019-01-10 12:55:15
【问题描述】:
我有一个名为 Geolocations 的列表,其中包含纬度和经度。
List<Geolocation> AllGeoLocations = new List<Geolocation>();
地理位置类:
public class Geolocation
{
public string Latitude { get; set; }
public string Longitude{ get; set; }
}
我将 ViewBag 中的这个列表从控制器发送到视图。
查看包:ViewBag.GeoList = AllGeoLocations;
在脚本下的视图中,在标记数组中,在 coords 内:{} 我想将从控制器发送的纬度和经度值放入 Viewbag。
<script>
var map;
var src = 'https://s3-ap-southeast-1.amazonaws.com/cloudcreativeltd/Rail_Ex_RoW_my.kml';
function initMap() {
// Map options
var options = {
zoom: 12,
center: { lat: 23.6850, lng: 90.3563 }
}
// New map
var map = new google.maps.Map(document.getElementById('map'), options);
// Array of markers
var markers = [
{
coords: { lat: , lng: },
content: '<h1></h1>'
}
];
</script>
【问题讨论】:
标签: javascript c# ajax asp.net-mvc