hkhoanguyen Posted November 1, 2017 Report Posted November 1, 2017 (edited) Hi, I'm using some examples on the internet to develop a small moving map, however, on the map the plane is flying a few mile to the left / right of the red flight plan polyline (photo attached) I wonder if the code that I'm using does not have a right data type (missing some decimal value ?) Note that the flight plan polyline (red) that I draw on the map based on the coordinates that generated by PFPX (*.pln file) here is the example code that I got from the internet I dont remember where, may be from this forum : Do you have any idea ? Thanks Photo : https://ibb.co/bSHtCb Quote private Offset<long> playerLatitude = new Offset<long>(0x0560); // Offset for Lat/Lon features private Offset<long> playerLongitude = new Offset<long>(0x0568); // Offset for Lat/Lon features var lon = new FsLongitude(playerLongitude.Value); var lat = new FsLatitude(playerLatitude.Value); // This will help us force the period as our decimal separator var nfi = new NumberFormatInfo { NumberDecimalSeparator = ".", NumberGroupSeparator = "," }; var playerData = new PlayerData(); playerData.id = "123"; // Set your own ID here v playerData.lon = lon.DecimalDegrees.ToString(nfi); playerData.lat = lat.DecimalDegrees.ToString(nfi); Edited November 1, 2017 by hkhoanguyen 1
Paul Henty Posted November 1, 2017 Report Posted November 1, 2017 The code you posted looks good to me. I can see that the .pnl files store the lat/lon as degrees and decimal minutes (e.g. E45* 36.1'). Whereas you're asking for DecimalDegrees from FSUIPC. Are you sure you've converted these two different formats correctly? E45* 36.1' would be 45.6017 in decimal degrees. If you can share some more code it might be helpful. For example, the code that converts the coordinates from the .pln and from the playerData into the values used for the map drawing. Paul 1
hkhoanguyen Posted November 1, 2017 Author Report Posted November 1, 2017 22 hours ago, Paul Henty said: The code you posted looks good to me. I can see that the .pnl files store the lat/lon as degrees and decimal minutes (e.g. E45* 36.1'). Whereas you're asking for DecimalDegrees from FSUIPC. Are you sure you've converted these two different formats correctly? E45* 36.1' would be 45.6017 in decimal degrees. If you can share some more code it might be helpful. For example, the code that converts the coordinates from the .pln and from the playerData into the values used for the map drawing. Paul Thanks Paul for your quick reply, Yes in javascript I have one function that convert E45* 36.1' from PFPX *.pln into "only decimal" value ("50.1506435458109") Here in the the JS function : parseDMS So there are 2 different sources , lat and long that are sent from FSUIPC .NET to the web client that draws the green polyline following the plane, and the other that gets coordinates from *.pln and draw them on google map as red polylin
Frédéric-O DUCHEMIN Posted November 1, 2017 Report Posted November 1, 2017 Bonsoir, Votre *.pln vous le placer sur votre serveur ? Vous travailler en local ? PHP/MySQL? Cordialement Fred
hkhoanguyen Posted November 2, 2017 Author Report Posted November 2, 2017 14 hours ago, Frédéric-O DUCHEMIN said: Bonsoir, Votre *.pln vous le placer sur votre serveur ? Vous travailler en local ? PHP/MySQL? Cordialement Fred Bonjour, désolé pour le retard, mon fichier .pln est en local, c'est juste une petite appli wpf qui envoie des GPS coordinates à mon web client(c#/HTML). Sorry to post in french as M Frédéric asked me in french.
Frédéric-O DUCHEMIN Posted November 2, 2017 Report Posted November 2, 2017 Ok thanks for your reply have you seen my MP ? Regards Fred
Paul Henty Posted November 2, 2017 Report Posted November 2, 2017 The javascript looks fine as long as the incoming format is correct. Do you have a sample of one of your .pln files? Paul
hkhoanguyen Posted November 2, 2017 Author Report Posted November 2, 2017 33 minutes ago, Paul Henty said: The javascript looks fine as long as the incoming format is correct. Do you have a sample of one of your .pln files? Paul Thanks Paul for your reply, yes I have it here, created by PFPX . By the way, for example: <WorldPosition>N44° 49' 43.001975",W0° 42' 55.000000",+000166.00</WorldPosition> I just took the two first as they are lat and lgn, i'm not sure about the third parameter (+000166.00), do you have any idea and do you think it affects to the precision ? Thanks LFBDENGM01.pln 6 hours ago, Frédéric-O DUCHEMIN said: Ok thanks for your reply have you seen my MP ? Regards Fred Yes, I received it, will reply you tonight.
Paul Henty Posted November 2, 2017 Report Posted November 2, 2017 Thanks - do you process this string first before sending it to the Javascript function? N44° 49' 43.001975",W0° 42' 55.000000",+000166.00 The Javascript won't work properly on that string. Paul
hkhoanguyen Posted November 2, 2017 Author Report Posted November 2, 2017 1 hour ago, Paul Henty said: Thanks - do you process this string first before sending it to the Javascript function? N44° 49' 43.001975",W0° 42' 55.000000",+000166.00 The Javascript won't work properly on that string. Paul Yes, I do, in my wpf application, I have one function that reads xml file and get only the first two lat and lng into a List of <string> and send them to JS
Paul Henty Posted November 2, 2017 Report Posted November 2, 2017 Okay, that looks fine too - although the Javascript wants a space between the lon and lat, not a +. Presumably you change that somewhere else. The next thing to check would be how the objects are drawn on the map. Do you pass them as decimal degrees without further processing? Did you write the map control? If so check for rounding problems (rounding too early) when you're converting the degrees to screen coordinates. Also are you sure the plane is flying on the correct course? Can't really see anything wrong at the moment. The FSUIPC side of things is fine. I'll be happy to check more of the code if you want to post it. (Use PM if you don't want it public). Paul 1
hkhoanguyen Posted November 2, 2017 Author Report Posted November 2, 2017 47 minutes ago, Paul Henty said: Okay, that looks fine too - although the Javascript wants a space between the lon and lat, not a +. Presumably you change that somewhere else. The next thing to check would be how the objects are drawn on the map. Do you pass them as decimal degrees without further processing? Did you write the map control? If so check for rounding problems (rounding too early) when you're converting the degrees to screen coordinates. Also are you sure the plane is flying on the correct course? Can't really see anything wrong at the moment. The FSUIPC side of things is fine. I'll be happy to check more of the code if you want to post it. (Use PM if you don't want it public). Paul Thanks Paul for your kindness, Yes, I pass them as decimal degrees without any further processing, into the polyline of GMap Api I will check back on my side if I did anything wrong, and get back to you if I have some doubts. Thanks again, and have a nice day.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now