I'm new with ArcGis WebAppbuilder. I am building my own custom widget with which I draw a polyline on the map from the coordinates of a satellite. I have a given starting TLE,for example:
LEMUR-2-TENNYSONLILY
1 52732U 22057A 22171.76649313 .00007639 00000+0 45185-3 0 9997
2 52732 97.5213 286.3842 0010146 168.0171 192.1302 15.11692075 3937
I use Esri's function for converting to coordinates of this TLE which gives me in output: x: 106.18417662732989, y: 6.539393499416327. these coordinates then change based on a timestamp that changes from hour to hour given a start date and an end date.
With these coordinates I use the whole point construction procedure the esri method, create an array of points, add it to the polyline with .addPath() and everything works.
let date1 = new Date(this.dt1.value);
let date2 = new Date(this.dt2.value);
let hours = Math.round(Math.abs(date1 - date2) / 36e5);
let stampa = date1;
let polylineSymbol = new SimpleLineSymbol();
let polylineSymbol2 = new SimpleLineSymbol();
let coordinate = [];
let array = new Array(2);
let arrayTest= [];
for (let i = 0; i < hours; i++) {
stampa = this.addHours(1, date1);
coordinate[i] = this.getSatelliteLocation(stampa, this.line1.value, this.line2.value);
array[i] = new Point( [coordinate[i].x , coordinate[i].y], new SpatialReference({wkid: 102113}));
// console.log(array[0])
arrayTest.push(new Point( [coordinate[i].x , coordinate[i].y ], new SpatialReference({wkid: 102113})));
}
console.log(arrayTest)
let polyline = new Polyline(new SpatialReference({wkid: 102113}))
polyline.addPath(arrayTest);
polyline = webMercatorUtils.geographicToWebMercator(polyline);
this.map.graphics.clear();
this.map.graphics.add(new Graphic(polyline, polylineSymbol2));
The problem is that it always remains limited to one portion of the map and if I try to invert the coordinates it comes off the screen.
I have tried testing different SpatialReference and related "wkid" but it keeps giving me the same problem.
Can you tell me if I am forgetting something? I thank you for any reply