What I'm trying to accomplish is calling result.MappingWaypoints[i].lat();
and
result.MappingWaypoints[i].lng();
instead of result.MappingWaypoints[i].lat;
and result.MappingWaypoints[i].lng
.
Is this even possible?
var result = new Array();
result = {
'MappingWaypoints': MappingWaypoints,
'Flightime': flight_time_sec,
'PhotoArea': { 'SouthWest': MeterstoGPS(starting_photo_area),
'NorthEast': MeterstoGPS(end_photo_area)},
};
MappingWaypoints.push(
{
lat : current_point_gps.lat,
lng : current_point_gps.lng,
Radius : 10,
Altitude : Attitude,
ClimbRate : ClimbRate,
DelayTime : DelayTime,
WP_Event_Channel_Value : 100,
Heading : 0,
Speed : Speed,
CAM_Nick : 0,
Type : 1,
Prefix : "P"
}
Edit: I tried adding :
lat: function(){ return current_point_gps.lat},`
lng : function(){ return current_point_gps.lng},
But that doesn't work => all values of the array have the lat/long value of the first coord
edit2: Thanks to @DCoder for this answer in the comments below: this solved it for me.
lat: (function(v) { return function() { return v; } })(current_point_gps.lat)
I know this might seem to be a strange thing to do but an algorithm i'm using really needs to acces data as a function call because the algo also processes data from the google api where data is only accessible trough the same function call lat() and lng(). THANKS :)