小编Eya*_*yal的帖子

使用Google Maps V3保存多边形的纬度/经度

对于服务提供商网站,我使用下面的代码(从这里偷走它)来显示每个提供商所涵盖的地图和绘制区域.我如何返回并存储我绘制的每个形状的纬度/经度阵列?我需要将其保存到数据库中,以便稍后我可以在搜索特定区域内的提供程序时用于搜索查询.

<script type="text/javascript">
  var drawingManager;
  var selectedShape;
  var colors = ['#1E90FF', '#FF1493', '#32CD32', '#FF8C00', '#4B0082'];
  var selectedColor;
  var colorButtons = {};

  function clearSelection() {
    if (selectedShape) {
      selectedShape.setEditable(false);
      selectedShape = null;
    }
  }

  function setSelection(shape) {
    clearSelection();
    selectedShape = shape;
    shape.setEditable(true);
    selectColor(shape.get('fillColor') || shape.get('strokeColor'));
  }

  function deleteSelectedShape() {
    if (selectedShape) {
      selectedShape.setMap(null);
    }
  }

  function selectColor(color) {
    selectedColor = color;
    for (var i = 0; i < colors.length; ++i) {
      var currColor = colors[i];
      colorButtons[currColor].style.border = currColor == …
Run Code Online (Sandbox Code Playgroud)

google-api polygons latitude-longitude

5
推荐指数
1
解决办法
3868
查看次数

标签 统计

google-api ×1

latitude-longitude ×1

polygons ×1