【问题标题】:Google Map Geofence - Draw Rectangle [duplicate]谷歌地图地理围栏 - 绘制矩形[重复]
【发布时间】:2016-10-18 11:27:35
【问题描述】:

我正在尝试使用 Google Map API Reference 创建矩形地理围栏。使用这个 API 我得到了:

  1. 东北经纬度
  2. 西南纬度和经度

但对于我的项目,我想要所有 4 Vertex Lat。 & 长。坐标。请帮助我实现这一目标。任何帮助将不胜感激。

【问题讨论】:

    标签: google-maps google-maps-api-3 maps gis google-maps-api-2


    【解决方案1】:

    如果你有NE,SW

     North-East Latitude & Longitude = north_lat, east_lng 
     South-West Latitude & Longitude = south_lat, west_lng
    

    你有 rect coord ..

    在伪代码中

    rectangle coord  = (north_lat, west_lng)  
                       (north_lat, east_lng)
                       (south_lat, east_lng) 
                      ( south_lat, west_lng) 
     or using eg: the coords
    
     var bounds = {
       north: 44.599,
       south: 44.490,
       east: -78.443,
       west: -78.649
    };
    

    你可以使用矩形

    rectangle = new google.maps.Rectangle({
      bounds: bounds
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-06-18
      • 2023-03-14
      • 1970-01-01
      • 1970-01-01
      • 2013-05-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多