@aligassan wrote:
I am trying to get latitude and longitude from data json api for flight route then inject that data arrays to Google Maps polyline . Fetch data json api working fine without problem , but when l put objects inside Google Maps l get error
ERROR Error: Uncaught (in promise): TypeError: Cannot use 'in' operator to search for 'getPosition' in 40.11882 TypeError: Cannot use 'in' operator to search for 'getPosition' in 40.11882 at getLatLng (Common.js:544) at Array.map (<anonymous>) at Object.convertToPositionArray (Common.js:575) at Map.addPolyline (Map.js:1231) at vendor.js:76340
code
async getmarker(){ this.http.get('/v1/flightjson?flightId=201',{},{}).then( data=>{ // this.latitude = JSON.parse(data.data).result.response.data.flight.track.latitude // this.longitude = JSON.parse(data.data).result.response.data.flight.track for(let datas of JSON.parse(data.data).result.response.data.flight['track']) { let AIR_PORTS = [ this.longitude=(datas.longitude), this.longitude=(datas.longitude) ] console.log(this.latitude=(datas.latitude)) // Do something. this.map = GoogleMaps.create('map_canvas'); let polyline: Polyline = this.map.addPolylineSync({ points: AIR_PORTS, color: '#AA00FF', width: 10, geodesic: true, clickable: true // clickable = false in default }); polyline.on(GoogleMapsEvent.POLYLINE_CLICK).subscribe((params: any) => { let position: LatLng = <LatLng>params[0]; let marker: Marker = this.map.addMarkerSync({ position: position, title: position.toUrlValue(), disableAutoPan: true }); marker.showInfoWindow(); }); } }) }
console log for
AIR_PORTS
Posts: 1
Participants: 1