Google映射来自sql wth asp.net mvc的查询结果

时间:2014-02-24 10:38:50

标签: javascript asp.net-mvc google-maps-api-3

我找不到任何有关如何使用数据库查询(sql)并在地图上显示所有结果的消息,而我只有地址,  我有大约12,000个结果,我所拥有的只是街道名称&号码+城市名称, 我每次都能获得一个结果,我需要得到更多的结果

public async Task<ActionResult> Index()
{
    var model = await db.synagogues.Take(5).ToListAsync();
    return View(model.ToList());
}  

并按foreach获取地图结果。

function codeAddress() {

        var address = document.getElementById('address' + i).value;
        geocoder.geocode({ 'address': address }, function (results, status) {
            if (status == google.maps.GeocoderStatus.OK) {
                map.setCenter(results[0].geometry.location);
                var marker = new google.maps.Marker({
                    map: map,
                    position: results[0].geometry.location
                });
            } else {
                alert('Geocode was not successful for the following reason: ' + status);
            }
        });

}

    google.maps.event.addDomListener(window, 'load', initialize);

0 个答案:

没有答案