我正在制作一个应用程序,要求用户单击某个位置,然后将其通过Google Maps定向到该位置。这些位置是JSON文件的数组。这是列表在被编译时的样子...
我有这段代码可以拆分坐标,因为坐标在JSON文件中是向后的,因此需要翻转。
var FormatCoords = function(){
CoordinateToString = location.Point.coordinates.toString()
SplitCord = CoordinateToString.split(",")
$scope.Lat = SplitCord[1];
$scope.Lon = SplitCord[0];
var FinalCord = Lat.concat(Lon);
};
我的问题是,如何在单击某个位置时使上面的代码运行?
如果您想查看一下,这是我的代码的一大难题... http://plnkr.co/edit/OZZRgiEcrLzreW3lrc5v?p=preview
我想到了。您需要先编辑所有坐标,然后再单击该位置。
location.Point.coordinates = location.Point.coordinates.substring(0, clength - 2).split(",");
Lat = location.Point.coordinates[0]
Lon = location.Point.coordinates[1]
Com = ","
location.Point.coordinates = Lon.concat(Com,Lat)
因此,当应用加载时,它会删除Z坐标,然后翻转X和Y。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句