|
Download the Eye4Software GPS Toolkit fully functional 30 day trial version for free |
|
Download Eye4Software GPS Toolkit Manual |
|
Browse through the Eye4Software GPS Toolkit manual |
The Eye4Software GPS toolkit allows software developers to add GPS functionality to their own programs without the need to have any knowledge on serial communications and GPS protocols like RS-232 and NMEA0183.
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.
First you must have Visual Basic .Net and the Eye4Software GPS Component installed on your computer. We will use Visual Basic .Net 2008 in this document, but other versions from 2002 and up can be used. You can download the Eye4Software GPS Component here.
Start the Visual Studio IDE, and select the "New" => "Project" option from the "File" menu. The "New Project" dialog now appears, select the "Windows Application" option to generate a Windows GUI application.
In order to declare and create the objects from your Visual Basic .Net application, you need to add a reference to the ActiveX object, by choosing the "Add Reference..." option from the "Project" menu. A list of components installed on the system is displayed. Just select the "COM" tab, and select the "Eye4Software GPS Toolkit 3.0", click "Select" and finally click "OK".
After adding the reference to the control, you can declare the objects like this:
Private objProjection As GpsProjection Private objDatumSrc As GpsDatumParameters Private objDatumDst As GpsDatumParameters
The objects can be created in your code by double clicking on the Form you created, this will open the Formx_Load handler. Paste the following code in this function:
objProjection = New GpsProjection objDatumSrc = New GpsDatumParameters objDatumDst = New GpsDatumParameters
The following code shows how to perform a map datum conversion using the GPS Toolkit. In this example a position is transformed from WGS84 to NAD27. For a list of other supported map datums, please refer to our map datum list.
' ConvDatum Visual Basic .NET demo - Eye4Software GPS Toolkit
' This demo shows how to convert a latitude/longitude coordinate from one map datum to another.
' For more information on how to use the Eye4Software GPS Toolkit with Visual Basic .NET,
' visit http://www.eye4software.com/products/gpstoolkit/source#vbnet
Imports GpsToolkit
Module Module1
Private objProjection As GpsProjection
Private objSrcDatum As GpsDatumParameters
Private objDstDatum As GpsDatumParameters
Sub Main()
' Create instances of objects
objProjection = New GpsProjection
objSrcDatum = New GpsDatumParameters
objDstDatum = New GpsDatumParameters
' Set Source Datum ( WGS84 )
' The ID for WGS84 is 4326, see 'http://www.eye4software.com/resources/datums' for a full list of supported datums
' To convert from another datum, just change the code below (EPSG code)
' To define your own datum, please have a look at the 'ConvUserGrid' Visual Basic .NET demo.
objSrcDatum.LoadFromId(4326)
' Set Destination Datum ( NAD27 )
' The ID for NAD27 is 4267, see 'http://www.eye4software.com/resources/datums' for a full list of supported datums
' To convert to another datum, just change the code below (EPSG code)
' To define your own datum, please have a look at the 'ConvUserGrid' Visual Basic .NET demo.
objDstDatum.LoadFromId(4267)
' Set source latitude and longitude coordinates
objProjection.Latitude = 33.59
objProjection.Longitude = -112.15
' Perform datum transformation
objProjection.TransformDatum (objSrcDatum, objDstDatum)
' Get and display result
If (objProjection.LastError = 0) Then
Console.WriteLine("(WGS84) 33.590 N, 112.15 W => (NAD27) {0} N, {1} W",
objProjection.Latitude, objProjection.Longitude)
Else
Console.WriteLine("Error occured during datum transformation: {0} ({1})",
objProjection.LastError, objProjection.LastErrorDescription)
End If
Console.WriteLine("Ready.")
End Sub
End Module