|
Download the Eye4Software GPS Toolkit fully functional 30 day trial version for free |
|
Browse through the Eye4Software GPS Toolkit manual |
The Eye4Software GPS toolkit allows software developers to add GPS / Geodesy functionality to their own programs or scripts, without the need to have any knowledge on geodesy, serial communications and GPS protocols like NMEA0183.
The product offers the following functionality:
The product can be used in many programming environments, such as Visual Basic, Visual C++, Visual Studio.Net, Borland C++ Builder, Borland Delphi and VBA, but also web oriented applications such as ASP, ASP.NET and PHP, and all other programming environments that support ActiveX. For more information about the product, please visit the product's homepage.
First you must have MS Office or Excel and the Eye4Software GPS Component installed on your computer. We will use MS Excel 2003 in this document, but other versions that support VBA can also be used. You can download the Eye4Software GPS Component here.
Start MS Excel and create a blank workbook. You can use the worksheet as displayed below as an example, but you can also use another layout. Please note that the source code at the end of the document only works with this sample worksheet. To use it with your own design, you might have to adjust the cell row and columns in the VBA source.
The full MS Excel worksheet file is included in the product and can be find in the "Samples\Excel" folder.
NOTE: When you are unable to get the project working, you might want to check the macro security settings. By default, running VBA code is prohibited. To adjust the security settings, select "Tools" => "Macro" => "Security" from the menu, and set the security level to "Low".
To use controls and add VB sourcecode to the worksheet, you have to enable the "Control Toolbox". This can be done drom the menu by selecting: "View" => "Toolbars" => "Control Toolbox". The following toolbox appears:
The first button of the toolbox can be used to switch design mode on and off. When programming you have to turn it on, when you are ready to test the code, you have to exit designmode.
The third button from the left opens the source code editor, please press this button now to enter the first lines of the code.
To use the GPS Toolkit objects in your Excel document, you have to declare them first like this:
Dim objGpsProjection As Object Dim objGpsDatumSrc As Object Dim objGpsDatumDst As Object Dim objGpsGridSrc As Object Dim objGpsGridDst As Object
After you have add the declarations to your code, you can create the objects like this:
Set objGpsProjection = CreateObject("Eye4Software.GpsProjection")
Set objGpsDatumSrc = CreateObject("Eye4Software.GpsDatumParameters")
Set objGpsDatumDst = CreateObject("Eye4Software.GpsDatumParameters")
Set objGpsGridSrc = CreateObject("Eye4Software.GpsGridParameters")
Set objGpsGridDst = CreateObject("Eye4Software.GpsGridParameters")
You are now ready to use the component from within your Excel workbook / worksheet. You can now write the rest of the code, or use the source code below to use our sample worksheet:
Dim objGpsProjection As Object
Dim objGpsDatumSrc As Object
Dim objGpsDatumDst As Object
Dim objGpsGridSrc As Object
Dim objGpsGridDst As Object
Dim nRow As Integer
Private Sub CommandButton1_Click()
' Create the COM/OLE objects
Set objGpsProjection = CreateObject("Eye4Software.GpsProjection")
Set objGpsDatumSrc = CreateObject("Eye4Software.GpsDatumParameters")
Set objGpsDatumDst = CreateObject("Eye4Software.GpsDatumParameters")
Set objGpsGridSrc = CreateObject("Eye4Software.GpsGridParameters")
Set objGpsGridDst = CreateObject("Eye4Software.GpsGridParameters")
' Set Source Datum
objGpsDatumSrc.Axis = Range("G3").Value
objGpsDatumSrc.Flattening = Range("G4").Value
objGpsDatumSrc.TranslationX = Range("G6").Value
objGpsDatumSrc.TranslationY = Range("G7").Value
objGpsDatumSrc.TranslationZ = Range("G8").Value
objGpsDatumSrc.RotationX = Range("G9").Value
objGpsDatumSrc.RotationY = Range("G10").Value
objGpsDatumSrc.RotationZ = Range("G11").Value
objGpsDatumSrc.ScaleFactor = Range("G12").Value
' Set Source Projection
objGpsGridSrc.Datum = objGpsDatumSrc
objGpsGridSrc.Projection = Range("G14").Value
objGpsGridSrc.FalseEasting = Range("G15").Value
objGpsGridSrc.FalseNorthing = Range("G16").Value
objGpsGridSrc.OriginLatitude = Range("G17").Value
objGpsGridSrc.OriginLongitude = Range("G18").Value
objGpsGridSrc.ParallelNorth = Range("G19").Value
objGpsGridSrc.ParallelSouth = Range("G20").Value
objGpsGridSrc.ScaleFactor = Range("G21").Value
' Set Destination Datum
objGpsDatumDst.Axis = Range("G27").Value
objGpsDatumDst.Flattening = Range("G28").Value
objGpsDatumDst.TranslationX = Range("G30").Value
objGpsDatumDst.TranslationY = Range("G31").Value
objGpsDatumDst.TranslationZ = Range("G32").Value
objGpsDatumDst.RotationX = Range("G33").Value
objGpsDatumDst.RotationY = Range("G34").Value
objGpsDatumDst.RotationZ = Range("G35").Value
objGpsDatumDst.ScaleFactor = Range("G36").Value
' Set Destination Projection
objGpsGridDst.Datum = objGpsDatumDst
objGpsGridDst.Projection = Range("G38").Value
objGpsGridDst.FalseEasting = Range("G39").Value
objGpsGridDst.FalseNorthing = Range("G40").Value
objGpsGridDst.OriginLatitude = Range("G41").Value
objGpsGridDst.OriginLongitude = Range("G42").Value
objGpsGridDst.ParallelNorth = Range("G43").Value
objGpsGridDst.ParallelSouth = Range("G44").Value
objGpsGridDst.ScaleFactor = Range("G45").Value
' Transform coordinates one by one
For nRow = 2 To 50
If ((Cells(nRow, 1).Value <> "") And (Cells(nRow, 2).Value <> "")) Then
objGpsProjection.Latitude = Cells(nRow, 1).Value
objGpsProjection.Longitude = Cells(nRow, 2).Value
objGpsProjection.TransformGrid objGpsGridSrc, objGpsGridDst
Cells(nRow, 3).Value = objGpsProjection.Northing
Cells(nRow, 4).Value = objGpsProjection.Easting
End If
Next
End Sub