javascript - Google map 的 KML 坐标

标签 javascript html arrays angularjs google-maps

我正在尝试制作一个应用程序,以便用户能够单击链接(链接是位置),它将打开谷歌地图并将他们引导到该位置。我有以下代码:

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.14/angular.min.js"></script>
<meta charset="utf-8">
<title>ECC</title>
</head>
<body ng-app="app">
<div ng-controller="firstCtrl">
<input type="text" ng-model="search"/>
<ul>
<li ng-repeat="site in SiteLocs |filter : search ">{{site.name}}</li>
</ul>
</div>
</body>
</html>

JS

var app = angular.module('app', []);

app.controller('firstCtrl', function($scope){
 $scope.SiteLocs = [
   {
  "name": "502 Nelson St, Greenville, MS 38701",
  "visibility": "0",
  "description": "502 Nelson St, Greenville, MS 38701",
  "styleUrl": "#waypoint",
  "Point": {
    "coordinates": "-91.05636,33.415485,0"
  }

}
   , 
   {
  "name": "242 Blackhawk Trace, Galena, IL 61036",
  "visibility": "0",
  "description": "242 Blackhawk Trace, Galena, IL 61036",
  "styleUrl": "#waypoint",
  "Point": {
    "coordinates": "-90.319778,42.390862,0"
  }
}, (ect... there are a couple thousand of these so I wont add them all..)
];
});

我需要帮助的是链接它的自身。我不知道使用 href 将列表链接到什么。大家有什么想法吗?

最佳答案

我已经弄清楚了。这真的很简单。

<body>
  <div ng-controller="firstCtrl">
    <input type="text" ng-model="search" border="1"/>
    <ul>
      <li ng-repeat="site in SiteLocs |filter : search "><a href="http://maps.google.com/?q=" + 
      {{site.Point.coordinates}}>{{site.name}}</a></li>
    </ul>
  </div>
</body>

关于javascript - Google map 的 KML 坐标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24701371/

相关文章:

javascript - 如何将 json 对象插入 Google 图表线

javascript - 如何仅接受来 self 的 API 服务器的 cookie

html - 如何在div中居中动态变化的网格?

arrays - 数组排序算法的问题

html - 选择列表的第一个 child 而不包括孙子

html - 移动和桌面的响应式 css 中断

c - C : segmentation fault 中的 sizeof(数组)

javascript - 当窗口到达边界时使用变换停止 div 移动

javascript - Ember 路由或 Controller 将数据模型公开为 json

javascript - Vue组件无法加载: did you register the component correctly?