【问题标题】:ASP.NET MVC4 - A library to draw a world map and to draw circles on the map given a latitude/longitude and radiusASP.NET MVC4 - 一个绘制世界地图并在给定纬度/经度和半径的地图上绘制圆圈的库
【发布时间】:2013-09-24 16:21:09
【问题描述】:

我正在寻找一种能够在 ASP.NET MVC4 应用程序中绘制世界地图的简单解决方案。将呈现地图的特定视图将被强类型化为联系人记录的集合(IEnumerable)(联系人是我的对象)。在 Contact 类中,我将有一个纬度/经度/半径。我希望能够在地图上标出经纬度的点,并用半径在地图上画一个圆。

有人知道任何简单的解决方案吗?我查看了谷歌地图(他们有丰富的 API)——但我在他们的解决方案中缺少的部分是能够在给定纬度/经度坐标和半径的地图上绘制一个形状。

【问题讨论】:

    标签: c# asp.net-mvc api google-maps gis


    【解决方案1】:

    这确实可以通过 Google Maps API 实现。

    试试下面的

    function initialize() {
      var mapOptions = {
        zoom: 4,
        center: new google.maps.LatLng(34.052234, -118.243684),
        mapTypeId: google.maps.MapTypeId.TERRAIN
      };
    
      var map = new google.maps.Map(document.getElementById("map-canvas"),
          mapOptions);
    
      var circleOptions = {
          strokeColor: "#FF0000",
          strokeOpacity: 0.8,
          strokeWeight: 2,
          fillColor: "#FF0000",
          fillOpacity: 0.35,
          map: map,
          center: new google.maps.LatLng(34.052234, -118.243684),
          radius: 2000000
      };
      var circle = new google.maps.Circle(circleOptions);
    }
    

    这将在美国西海岸的地图上创建一个单曲。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-07-18
      • 1970-01-01
      • 2019-01-30
      • 2019-02-28
      • 1970-01-01
      • 2012-04-19
      • 1970-01-01
      相关资源
      最近更新 更多