Get Plane Coordinates of P3D
-
- Posts: 46
- Joined: Sat Feb 21, 2015 8:45 am
Get Plane Coordinates of P3D
Hi,
I would like to know how to get plane coordinates broadcasting by P3D ? I want to develop a moving map actually,
Thanks in advanced.
I would like to know how to get plane coordinates broadcasting by P3D ? I want to develop a moving map actually,
Thanks in advanced.
Re: Get Plane Coordinates of P3D
If you hit Shift+Z it will display your coordinates at the top left of the screen.
Best Regards,
Neal McCullough.
Neal McCullough.
-
- Posts: 46
- Joined: Sat Feb 21, 2015 8:45 am
Re: Get Plane Coordinates of P3D
Sorry if there is anything not clear in my question.
I wanted to get the GPS Coordinates of the plane in real time in order to develop a moving map that shows the plane actual position on the map.
Re: Get Plane Coordinates of P3D
Have you read the SDK?
Ed Wilson
Senior Developer
Mindstar Aviation
Senior Developer
Mindstar Aviation
-
- Posts: 46
- Joined: Sat Feb 21, 2015 8:45 am
Re: Get Plane Coordinates of P3D
Hi, Thanks for your reply,
I read the SDK and following to the example of getting the Data from Data Request Class.
However, I had this error while running my visual studio solution :
LockheedMartin.Prepar3D.SimConnect.dll is added into my References.System.BadImageFormatException occurred
HResult=0x8007000B
Message=Could not load file or assembly 'LockheedMartin.Prepar3D.SimConnect, Version=4.1.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Source=WindowsFormsApp1
StackTrace:
at WindowsFormsApp1.Form1..ctor() in C:\Users\P3D-PC\source\repos\ConsoleApp1\WindowsFormsApp1\Form1.cs:line 53
at WindowsFormsApp1.Program.Main() in C:\Users\P3D-PC\source\repos\ConsoleApp1\WindowsFormsApp1\Program.cs:line 19
I also tried to target to both x86 and x64 and Any CPU
Do you have any idea of how to solve this? Thanks
Re: Get Plane Coordinates of P3D
Why would you directly reference the DLL? I am not familiar with C# but shouldn't you be referencing SimConnect with it's header and library and not the DLL? Also, ensure you're using the correct version of Visual Studio.
Ed Wilson
Senior Developer
Mindstar Aviation
Senior Developer
Mindstar Aviation
Re: Get Plane Coordinates of P3D
@Ed There are a number of ways to link dlls in C#. Here is a snippet from one of my config manager projects that is in C#. The dlls (Xceed.Wpf.Toolkit.dll and SharpDX.DirectSound.dll) are then to be included in the installer, preferably in the same location as the exe.
using Xceed.Wpf.Toolkit;
using Xceed.Wpf.Toolkit.Themes;
using SharpDX.DirectSound;
There is another way I link to certain core system dlls. For example GetPrivateProfileString and WritePrivateProfileString. I simply place the following members in my C# base class.
[DllImport("kernel32")]
private static extern int GetPrivateProfileString(string section,
string key, string def, StringBuilder retVal,
int size, string filePath);
[DllImport("kernel32")]
private static extern long WritePrivateProfileString(string section,
string key, string val, string filePath);
@hkhoanguyen if you go to your SDK directory\lib\SimConnect\managed, you should see 2 dlls. LockheedMartin.Prepar3D.SimConnect.dll and LockheedMartin.Prepar3D.SimConnect.Debug.dll. Did you place the LockheedMartin.Prepar3D.SimConnect.dll in the same directory as your final executable?
using Xceed.Wpf.Toolkit;
using Xceed.Wpf.Toolkit.Themes;
using SharpDX.DirectSound;
There is another way I link to certain core system dlls. For example GetPrivateProfileString and WritePrivateProfileString. I simply place the following members in my C# base class.
[DllImport("kernel32")]
private static extern int GetPrivateProfileString(string section,
string key, string def, StringBuilder retVal,
int size, string filePath);
[DllImport("kernel32")]
private static extern long WritePrivateProfileString(string section,
string key, string val, string filePath);
@hkhoanguyen if you go to your SDK directory\lib\SimConnect\managed, you should see 2 dlls. LockheedMartin.Prepar3D.SimConnect.dll and LockheedMartin.Prepar3D.SimConnect.Debug.dll. Did you place the LockheedMartin.Prepar3D.SimConnect.dll in the same directory as your final executable?
Jonathan Bleeker
Milviz systems dev
Formerly known as Naruto-kun
Milviz systems dev
Formerly known as Naruto-kun
Re: Get Plane Coordinates of P3D
Right... why are you importing the DLL and not using the LIB file?
Ed Wilson
Senior Developer
Mindstar Aviation
Senior Developer
Mindstar Aviation
Re: Get Plane Coordinates of P3D
C# doesn't use libs in the same way as C++. After all, managed code is rather different from native.
Jonathan Bleeker
Milviz systems dev
Formerly known as Naruto-kun
Milviz systems dev
Formerly known as Naruto-kun
Re: Get Plane Coordinates of P3D
Reminds me of VB... LOL
Since the OP hasn't responded... guess we assume all is well? :)
Since the OP hasn't responded... guess we assume all is well? :)
Ed Wilson
Senior Developer
Mindstar Aviation
Senior Developer
Mindstar Aviation
Re: Get Plane Coordinates of P3D
Either way he got the answer to his problem at the end of my first reply. And yes I would guess VB is quite similar to C#.
Jonathan Bleeker
Milviz systems dev
Formerly known as Naruto-kun
Milviz systems dev
Formerly known as Naruto-kun
Re: Get Plane Coordinates of P3D
Arcane note: Borland's Delphi was a response to Microsoft's VB back in the day... and C# is Microsoft's response to Borland's Delphi. Both Delphi and C# were created by the same guy.
Ed Wilson
Senior Developer
Mindstar Aviation
Senior Developer
Mindstar Aviation
-
- Posts: 46
- Joined: Sat Feb 21, 2015 8:45 am
Re: Get Plane Coordinates of P3D
Hi Guys, Thanks a lot for your replies,
I managed to get the coordinates and display the plane on Google Map,
However, I have one question, of how to draw a line that follows the plane on google map ?
2nd question: how to draw a flight plan line from A to B on google map based on the list of waypoints we provide ?
as i'm new to this kind of development, it would be great for me if you guys have some ideas or links that I can look into.
Thanks,
I managed to get the coordinates and display the plane on Google Map,
However, I have one question, of how to draw a line that follows the plane on google map ?
2nd question: how to draw a flight plan line from A to B on google map based on the list of waypoints we provide ?
as i'm new to this kind of development, it would be great for me if you guys have some ideas or links that I can look into.
Thanks,
Re: Get Plane Coordinates of P3D
That you would best contact google for....I don't know of anyone here who has done that.
Jonathan Bleeker
Milviz systems dev
Formerly known as Naruto-kun
Milviz systems dev
Formerly known as Naruto-kun
-
- Posts: 46
- Joined: Sat Feb 21, 2015 8:45 am
Re: Get Plane Coordinates of P3D
There are many examples out there like fsxtracker.com or other moving map... I just still don't know how to implement that, any idea would helpNaruto-kun wrote: ↑Mon Oct 23, 2017 2:58 pm That you would best contact google for....I don't know of anyone here who has done that.