Eye4Software GPS Toolkit 4.0 - Manual

Download Eye4Software GPS Toolkit free trial Download the Eye4Software GPS Toolkit fully functional 30 day trial version for free
Download Eye4Software Coordinate GPS Toolkit Manual Download Eye4Software GPS Toolkit Manual
Browse through the Eye4Software GPS Toolkit for Windows manual Browse through the Eye4Software GPS Toolkit manual

Table of Contents

Previous Versions

View the Eye4Software GPS Toolkit version 2.2 manual
View the Eye4Software GPS Toolkit version 2.4 manual
View the Eye4Software GPS Toolkit version 3.0 manual
View the Eye4Software GPS Toolkit version 3.2 manual

Introduction

Overview
Supported programming languages
Requirements
Supported GPS hardware
Installation

Getting Started

Overview
Visual C++
Visual Basic
Visual Basic .NET
Visual C# .NET
VBScript
Borland Delphi

The GpsConstants object

Overview
Dataformat constants
NMEA filter constants
Speed units constants
Altitude units constants
Latitude and Longitude format constants
Projection constants
Projection units constants

The GpsSatelliteInfo object

Overview
Properties
Functions

The Gps object

Overview
Properties
Functions

The GpsDatumParameters object

Overview
Properties
Functions

The GpsGridParameters object

Overview
Properties
Functions

The GpsProjection object

Overview
Properties
Functions

The GpsUtilities object

Overview
Properties
Functions


Introduction

Overview

The Eye4Software GPS Toolkit, is a software component that helps you developing your own GPS applications, including Track and Trace, Navigation, Positioning, Hydrographic Survey, construction and much more. The core of the toolkit is the a single "GpsCtl32.dll" (32bit) or "GpsCtl64.dll" (64bit) file.
The toolkit offers the following features:

  • Supports up to 256 serial ports, including RS232, Bluetooth and USB serial ports;
  • Supports Garmin GPS devices connected by USB (Garmin PVT protocol);
  • Decodes the most common used GPS NMEA0183 sentences like: GGA, GLL, GSA, GSV, RMC, RME, RMZ, VTG and ZDA;
  • Outputs latitude and longitude as both decimal and (user defined) string representations;
  • Conversion between units, like km/h, mph, feet, knots, meters;
  • Conversion between geodetic map datums and reference ellipsoids;
  • Conversion between latitude / longitude and map projections;
  • Convert coordinates between NAD83 and NAD27 using NADCON correction files;
  • Convert coordinates between NAD83 and NAD83(HARN) using HARN/HPGN correction files;
  • Convert coordinates between different map datums using NTv2 correction files;
  • Distance and Azimuth calculation using Vincenty's formula;
  • Built-in support for more then 500 map datums and 5000 map grids.

When the toolkit is used to convert coordinates, the following map projections are supported:

  • Lambert Conformal Conic (LCC) 1SP projection;
  • Lambert Conformal Conic (LCC) 1SP projection (West Orientated);
  • Lambert Conformal Conic (LCC) 2SP projection;
  • Lambert Conformal Conic (LCC) 2SP projection (Belgium);
  • Lambert Equal Area Conic projection;
  • Transverse Mercator projection;
  • Transverse Mercator projection (South Orientated);
  • Oblique Mercator projection;
  • Hotine Oblique Mercator projection;
  • Swiss Oblique Mercator projection;
  • Oblique Stereographic projection;
  • Polar Stereographic projection;
  • Albers Equal Area Conic projection;
  • Cassini Soldner projection;
  • Mercator projection 1SP;
  • Mercator projection 2SP;
  • Polyconic projection;
  • Gauss Kruger projection;
  • Universal Transverse Mercator (UTM) projection;
  • Mollweide projection;
  • Eckert IV projection;
  • Eckert VI projection;
  • Krovak projection;
  • Cylindrical Equal Area projection;
  • Sinusoidal projection;
  • Miller projection;
  • Bonne projection.
  • Gall Stereographic projection;
  • Robinson projection;
  • Equirectangular projection;
  • Equidistant Conic projection;
  • Loximuthal projection;
  • Plate Carree projection;
  • van der Grinten I projection;
  • Winkel I projection;
  • Orthographic projection;
  • Gnomonic projection;

Supported programming languages

The toolkit can be used with every programming language which supports the use of ActiveX / COM objects.
Some development environments that include ActiveX are:

  • Microsoft Visual C++;
  • Microsoft Visual Basic;
  • Microsoft Visual C# .Net;
  • Microsoft Visual Basic .Net;
  • Microsoft VBScript;
  • Microsoft Visual Basic for Applications (MS Excel, MS Access, MS Word);
  • Microsoft ASP;
  • Microsoft ASP .NET;
  • Borland C++ Builder;
  • Borland Delphi;
  • PHP;
  • Coldfusion;
  • Powerbuilder.

Requirements

The toolkit can be used to write applications or scripts for the following platforms:

Server Platforms:

  • Windows 2003 Server;
  • Windows 2008 Server;
  • Windows 2003 R2 Server;
  • Windows 2008 R2 Server.

Desktop Platforms:

  • Windows XP SP2 or higher;
  • Windows Vista;
  • Windows 7.

Supported GPS hardware

You can use all GPS devices equipped with a NMEA0183 port, or Garmin GPS devices equipped with an USB connector. If you do not have such a device, you also use a GPS or NMEA0183 simulator to get started with your project. All NMEA0183 versions are currently supported.

NOTE: When using a Garmin GPS device, connected using an USB cable, no virtual serial port driver is needed, the GPS Toolkit communicates directly with Garmin's USB driver using Garmin's PVT protocol.

Installation

There are 2 ways to install this software on your computer:

Automatic Installation

To use the automatic installation, just download the installer from our website.
The setup wizard will guide you through the installation process. After installation has been completed, all components and code samples are installed on your computer.


Manual Installation
When you want to include the product in your installer, or you wan to test the component on a pc without using the setup wizard, just copy the core of the toolkit, the "GpsCtl32.dll" or GpsCtl64.dll (depending on the target platform) to the target computer, and register the control with the REGSVR32 command like this (replace the path with the path to your copy of the file):

REGSVR32 C:\Program Files\Eye4Software\Gps Toolkit\Program\GpsCtl32.dll

or for a x64 platform:

REGSVR32 C:\Program Files\Eye4Software\Gps Toolkit\Program\GpsCtl64.dll

When you encounter any troubles registering the component, make sure you have Administrator rights and/or UAC is turned off.

Getting Started

Overview

This section of the manual describes how to use the component in the various programming environments.
If your programming language is not listed, please contact our support department.

Microsoft Visual C++

First, you have to create a new project. The toolkit can be used with both GUI and Console projects. Make sure the component is installed and registered on your development PC. For installation on a development PC, the automatic installation is recommended.

In order to use the GPS toolkit from Visual C++, you have to copy some include files to your new project folder. These files are included in the Visual C++ sample included with the product: "GpsCtrl.h", "GpsCtrl_i.c" and "GpsConstantsX.h".

In the source file you are going to use the component, include the following lines of code:

#include "GpsCtrl.h"
#include "GpsCtrl_i.c"
#include "GpsConstantsX.h"

Declare the component in your code like this:

IGps                *   m_pGps                  = NULL;
IGpsUtilities       *   m_pUtilities            = NULL;
IGpsProjection      *   m_pGpsProjection        = NULL;
IGpsDatumParameters *   m_pGpsDatumParameters   = NULL;
IGpsGridParameters  *   m_pGpsDatumParameters   = NULL;

Because we are going to use an ActiveX object, we have to initialize COM like this:

CoInitialize ( NULL );

Now you should be able to create an instance of the object(s), always make sure that you check the m_pGps pointer before using it, if its value is NULL, most probably the component isn't registered on the system.

CoCreateInstance ( CLSID_Gps, NULL, CLSCTX_INPROC_SERVER, IID_IGps, ( void ** ) &m_pGps );
CoCreateInstance ( CLSID_GpsUtilities, NULL, CLSCTX_INPROC_SERVER, IID_IGpsUtilities, ( void ** ) &m_pGpsUtilities );
CoCreateInstance ( CLSID_GpsProjection, NULL, CLSCTX_INPROC_SERVER, IID_IGpsProjection, ( void ** ) &m_pGpsProjection );
CoCreateInstance ( CLSID_GpsDatumParameters, NULL , CLSCTX_INPROC_SERVER, IID_IGpsDatumParameters, ( void ** ) &m_pGpsDatumParameters );
CoCreateInstance ( CLSID_GpsGridParameters, NULL, CLSCTX_INPROC_SERVER, IID_IGpsGridParameters, ( void ** ), &m_pGpsGridParameters );

For more info about using the Eye4Software GPS Toolkit with Visual C++, please visit this document.

Visual Basic

First you have to create a new project. The toolkit can be used with both GUI and Console projects, for a GUI object, just select the "Standard EXE" project option. Make sure the component is installed and registered on your development PC. For installation on a development PC, the automatic installation is recommended.

In order to use the GPS Toolkit from Visual Basic, you have to add a reference to the ActiveX control. You can do this by selecting the "References..." option from the "Project" menu, and check the checkbox in front of the "Eye4Software GPS Toolkit" and click "OK". Declare the component in your code like this:

Private objGps                  As Gps
Private objGpsUtilities         As GpsUtilities
Private objGpsProjection        As GpsProjection
Private objGpsDatumParameters   As GpsDatumParameters
Private objGpsGridPatameters    As GpsGridParameters
Private objGpsConstants         As GpsConstants

Now you should be able to create an instance of the object(s), always make sure that you check the objGps object (it should not be Null) before using it.

Set objGps                  = CreateObject ("Eye4Software.Gps")
Set objGpsUtilities         = CreateObject ("Eye4Software.GpsUtilities")
Set objGpsProjection        = CreateObject ("Eye4Software.GpsProjection")
Set objGpsDatumParameters   = CreateObject ("Eye4Software.GpsDatumParameters")
Set objGpsGridParameters    = CreateObject ("Eye4Software.GpsGridParameters")
Set objGpsConstants         = CreateObject ("Eye4Software.GpsConstants")

For more info about using the Eye4Software GPS Toolkit with Visual Basic, please visit this document.

Visual Basic .NET

First you have to create a new project. The toolkit can be used with both .NET Windows Forms and Console Application projects, for a Windows Forms object, just select the "Windows Application" project option. Make sure the component is installed and registered on your development PC. For installation on a development PC, the automatic installation is recommended.

In order to use the GPS Toolkit from Visual Basic .NET, you have to add a reference to the ActiveX control. You can do this by selecting the "Add Reference..." option from the "Project" menu, and check the checkbox in front of the "Eye4Software GPS Toolkit 2.2" and click "OK". Declare the component in your code like this:

Private objGps                  As Gps
Private objGpsUtilities         As GpsUtilities
Private objGpsProjection        As GpsProjection
Private objGpsDatumParameters   As GpsDatumParameters
Private objGpsGridPatameters    As GpsGridParameters
Private objGpsConstants         As GpsConstants

Now you should be able to create an instance of the object(s), always make sure that you check the objGps object (it should not be Null) before using it.

objGps                  = New Gps
objGpsUtilities         = New GpsUtilities
objGpsProjection        = New GpsProjection
objGpsDatumParameters   = New GpsDatumParameters
objGpsGridParameters    = New GpsGridParameters
objGpsConstants         = New GpsConstants

For more info about using the Eye4Software GPS Toolkit with Visual Basic .NET, please visit this document.

Visual C# .NET

First you have to create a new project. The toolkit can be used with both .NET Windows Forms and Console Application projects, for a Windows Forms object, just select the "Windows Application" project option. Make sure the component is installed and registered on your development PC. For installation on a development PC, the automatic installation is recommended.

In order to use the GPS Toolkit from Visual C# .NET, you have to add a reference to the ActiveX control. You can do this by selecting the "Add Reference..." option from the "Project" menu, and check the checkbox in front of the "Eye4Software GPS Toolkit" and click "OK". Declare the component in your code like this:

private Gps objGps;
private GpsUtilities objGpsUtilities;
private GpsProjection objGpsProjection;
private GpsConstants objGpsConstants;
private GpsDatumParameters objGpsDatumParameters;
private GpsGridParameters objGpsGridParameters;

Now you should be able to create an instance of the object(s), always make sure that you check the objGps object (it should not be Null) before using it.

objGps                  = new Gps();
objGpsUtilities         = new GpsUtilities();
objGpsProjection        = new GpsProjection();
objGpsDatumParameters   = new GpsDatumParameters();
objGpsGridParameters    = new GpsGridParameters();
objGpsConstants         = new GpsConstants();

For more info about using the Eye4Software GPS Toolkit with Visual C# .NET, please visit this document.

VBScript

First you have to create a script file using notepad or a VBS editor. Make sure the component is installed and registered on your development PC. For installation on a development PC, the automatic installation is recommended.

Declare the component in your script like this:

Dim objGps
Dim objGpsUtilities
Dim objGpsProjection
Dim objGpsDatumParameters
Dim objGpsGridPatameters
Dim objGpsConstants

Now you should be able to create an instance of the object, always make sure that you check the objGps object (it should not be Null) before using it.

Set objGps                  = CreateObject ("Eye4Software.Gps")
Set objGpsUtilities         = CreateObject ("Eye4Software.GpsUtilities")
Set objGpsProjection        = CreateObject ("Eye4Software.GpsProjection")
Set objGpsDatumParameters   = CreateObject ("Eye4Software.GpsDatumParameters")
Set objGpsGridParameters    = CreateObject ("Eye4Software.GpsGridParameters")
Set objGpsConstants         = CreateObject ("Eye4Software.GpsConstants")

For more info about using the Eye4Software GPS Toolkit with VBScript, please visit this document.

Borland Delphi

First you have to create a new project. Make sure the component is installed and registered on your development PC. For installation on a development PC, the automatic installation is recommended.

Declare the component in your code like this:

var
  objGps			        : Variant;
  objGpsUtilities     : Variant;
  objGpsProjection    : Variant;
  objGpsDatumSrc      : Variant;
  objGpsDatumDst      : Variant;
  objGpsGridSrc       : Variant;
  objGpsGridDst       : Variant;
  objGpsConstants     : Variant;

Now you should be able to create an instance of the object, always make sure that you check the objGps object (it should not be Null) before using it.

  objGps            := CreateOleObject ( 'Eye4Software.Gps' );
  objGpsUtilities   := CreateOleObject ( 'Eye4Software.GpsUtilities');
  objGpsProjection  := CreateOleObject ( 'Eye4Software.GpsProjection' );
  objGpsDatumSrc    := CreateOleObject ( 'Eye4Software.GpsDatumParameters' );
  objGpsDatumDst    := CreateOleObject ( 'Eye4Software.GpsDatumParameters' );
  objGpsGridSrc     := CreateOleObject ( 'Eye4Software.GpsGridParameters' );
  objGpsGridDst     := CreateOleObject ( 'Eye4Software.GpsGridParameters' );
  objGpsConstants   := CreateOleObject ( 'Eye4Software.GpsConstants' );

For more info about using the Eye4Software GPS Toolkit with Borland Delphi, please visit this document.

The 'GpsConstants' object

Overview

The GpsConstants is an object which only contains constants, which can be used in other objects.
Some examples of constants are the values used to specify units, latitude / longitude format etc.

Dataformat Constants

Constant Value Description
GPS_DEVICE_FORMAT_DEFAULT 0 Use default dataformat on the serial port
GPS_DEVICE_FORMAT_8N1 1 Use ,N,8,1 dataformat on the serial port
GPS_DEVICE_FORMAT_7E1 2 Use ,E,7,1 dataformat on the serial port

NMEA Filter Constants

Constant Value Description
GPS_NMEA_FILTER_GGA 1 Decode the GGA sentences
GPS_NMEA_FILTER_GLL 2 Decode the GLL sentences
GPS_NMEA_FILTER_RMC 4 Decode the RMC sentences
GPS_NMEA_FILTER_VTG 8 Decode the VTG sentences
GPS_NMEA_FILTER_GSA 16 Decode the GSA sentences
GPS_NMEA_FILTER_GSV 32 Decode the GSV sentences
GPS_NMEA_FILTER_RME 4096 Decode Garmin proprietary RME sentences
GPS_NMEA_FILTER_RMZ 8192 Decode Garmin proprietary RMZ sentences

Speed Units

Constant Value Description
GPS_SPEED_KNOTS 0 Return speed in knots
GPS_SPEED_MILESPERHOUR 1 Return speed in miles per hours
GPS_SPEED_KILOMETERSPERHOUR 2 Return speed in kilometer per hour
GPS_SPEED_METERSPERSECOND 3 Return speed in meters per second

Altitude Units

Constant Value Description
GPS_ALTITUDE_METERS 0 Return altitude in meters
GPS_ALTITUDE_FEET 1 Return altitude in feet

Latitude and Longitude formats

Constant Value Description
GPS_LATLONFORMAT_D 0 Return position in dd.dddd format
GPS_LATLONFORMAT_DM 1 Return position in dd mm.mm format
GPS_LATLONFORMAT_DMS 2 Return position in dd mm sss format

Grid Projections

Constant Value Description
GPS_PROJECTION_NONE 0 Do not use grid, just use latitude and longitude (default)
GPS_PROJECTION_LAMBERT1SP 100 Use Lambert Conformal Conic projection with one standard parallel
GPS_PROJECTION_LAMBERT1SPWEST 100 Use Lambert Conformal Conic projection with one standard parallel, West orientated as used in Iceland, Greenland and Faroe
GPS_PROJECTION_LAMBERT2SP 110 Use Lambert Conformal Conic projection with two standard parallels
GPS_PROJECTION_LAMBERT2SPBELGIUM 110 Use Lambert Conformal Conic projection with two standard parallels (Belgium Variant)
GPS_PROJECTION_LAMBERTAEA 120 Use Lambert Azimuthal Equal Area projection
GPS_PROJECTION_ALBERSEQUALAREA 130 Use Albers Equal Area Conic projection
GPS_PROJECTION_MERCATOR1SP 140 Use Mercator projection with one standard parallel
GPS_PROJECTION_MERCATOR2SP 150 Use Mercator projection with two standard parallels
GPS_PROJECTION_TRANSVERSEMERCATOR 160 Use Transverse Mercator projection
GPS_PROJECTION_TRANSVERSEMERCATORSOUTH 160 Use Transverse Mercator projection, south orientated, as used in South Africa
GPS_PROJECTION_OBLIQUEMERCATOR 170 Use Oblique Mercator projection
GPS_PROJECTION_HOTINEOBLIQUEMERCATOR 180 Use Hotine Oblique Mercator projection
GPS_PROJECTION_SWISSOBLIQUEMERCATOR 190 Use Swiss Oblique Mercator projection
GPS_PROJECTION_STEREOGRAPHIC 210 Use Stereographic projection
GPS_PROJECTION_POLARSTEREOGRAPHIC 220 Use Polar Stereographic projection
GPS_PROJECTION_CASSINI 230 Use Cassini projection
GPS_PROJECTION_KROVAK 240 Use Krovak projection
GPS_PROJECTION_POLYCONIC 250 Use Polyconic projection
GPS_PROJECTION_MOLLWEIDE 260 Use Mollweide projection
GPS_PROJECTION_ECKERTI 271 Use Eckert I projection
GPS_PROJECTION_ECKERTII 272 Use Eckert II projection
GPS_PROJECTION_ECKERTIII 273 Use Eckert III projection
GPS_PROJECTION_ECKERTIV 274 Use Eckert IV projection
GPS_PROJECTION_ECKERTV 275 Use Eckert V projection
GPS_PROJECTION_ECKERTVI 276 Use Eckert VI projection
GPS_PROJECTION_WINKELI 281 Use Winkel I projection
GPS_PROJECTION_CYLINDRICALEQUALAREA 290 Use Cylindrical Equal Area projection
GPS_PROJECTION_SINUSOIDAL 300 Use Sinusoidal projection
GPS_PROJECTION_MILLER 310 Use Miller projection
GPS_PROJECTION_BONNE 320 Use Bonne projection
GPS_PROJECTION_GALLSTEREOGRAPHIC 330 Use Gall Stereographic projection
GPS_PROJECTION_ROBINSON 340 Use Robinson projection
GPS_PROJECTION_EQUIRECTANGULAR 350 Use Equidistance Conic (Equirectangular) projection
GPS_PROJECTION_LOXIMUTHAL 360 Use Loximuthal projection
GPS_PROJECTION_PLATECARREE 370 Use Plate Carree projection
GPS_PROJECTION_GRINTENI 381 Use van der Grinten I projection
GPS_PROJECTION_ORTHOGRAPHIC 390 Use Orthographic projection
GPS_PROJECTION_GNOMONIC 400 Use Gnomonic projection

Projection Units

Constant Value Description
GPS_PROJECTION_UNITS_M 9001 Meter (default)
GPS_PROJECTION_UNITS_KM 9036 Kilometer
GPS_PROJECTION_UNITS_GLM 9031 German Legal Meter
GPS_PROJECTION_UNITS_FT 9002 International Foot
GPS_PROJECTION_UNITS_FTBR 9095 British Foot
GPS_PROJECTION_UNITS_FTCLA 9005 Clarke's Foot
GPS_PROJECTION_UNITS_FTGC 9094 Gold Coast Foot
GPS_PROJECTION_UNITS_FTIND 9080 Indian Foot
GPS_PROJECTION_UNITS_FTSE 9041 British Foot (Sears)
GPS_PROJECTION_UNITS_FTUS 9003 U.S. Survey Foot
GPS_PROJECTION_UNITS_LK 9098 Link
GPS_PROJECTION_UNITS_LKCLA 9039 Clarke's Link
GPS_PROJECTION_UNITS_LKSE 9043 British Link (Sears)
GPS_PROJECTION_UNITS_LKUS 9034 U.S. Survey Link
GPS_PROJECTION_UNITS_MI 9093 Statute Mile
GPS_PROJECTION_UNITS_MIUS 9035 U.S. Survey Mile
GPS_PROJECTION_UNITS_NM 9030 Nautical Mile
GPS_PROJECTION_UNITS_CH 9097 Chain
GPS_PROJECTION_UNITS_CHCLA 9038 Clarke's Chain
GPS_PROJECTION_UNITS_CHSE 9042 British Chain (Sears)
GPS_PROJECTION_UNITS_CHUS 9033 U.S. Survey Chain
GPS_PROJECTION_UNITS_YDIND 9084 Indian Yard
GPS_PROJECTION_UNITS_YDCLA 9037 Clarke's Yard
GPS_PROJECTION_UNITS_CHUS 9040 British Yard (Sears)

Datum Shift Grid Type

Constant Value Description
GPS_GRIDTYPE_NONE 0 Do not use a datum shift grid (default)
GPS_GRIDTYPE_NADCON 3 Use a NADCON datum shift file
GPS_GRIDTYPE_HARN 4 Use a HARN/HPGN datum shift file
GPS_GRIDTYPE_NTV2 5 Use a NTv2 datum shift file

The 'GpsSatelliteInfo' object

Overview

The GpsSatelliteInfo object is used only with the following functions: GetFirstSatellite and GetNextSatellite. It is used to hold information about a satellite used to calculate a fix. The object stores information about the satellite's ID, elevation, azimuth and signal strength.

Object Properties

Property Name Type Description
ID String ID or PRN # of this satellite
Elevation String Elevation of this satellite
Azimuth String Azimuth of this satellite
SignalNoiseRatio String Signal strength of this satellite
UsedForFix String Specifies whether this satellite has been used to calculate the current position fix


Object Functions

Function Name Description
Clear Clears all property values


ID property

Type:

Number

In/Out:

Out

Optional:

Yes

Description:

The PRN# or SVID of the current GPS satellite.

Code Sample:

...
Set objSat = objGps.GetFirstSatellite ()

While ( objGps.LastError = 0 )

 WScript.Echo "Info for satellite #" & objSat.ID
 WScript.Echo " Azimuth     : " & objSat.Azimuth
 WScript.Echo " Elevation   : " & objSat.Elevation
 WScript.Echo " Signal      : " & objSat.SignalNoiseRatio
 WScript.Echo " Used        : " & objSat.UsedForFix

 Set objSat = objGps.GetNextSatellite ()
WEnd


Elevation property

Type:

Number

In/Out:

Out

Optional:

Yes

Description:

The elevation of the current GPS satellite in degrees.

Code Sample:

...
Set objSat = objGps.GetFirstSatellite ()

While ( objGps.LastError = 0 )

 WScript.Echo "Info for satellite #" & objSat.ID
 WScript.Echo " Azimuth     : " & objSat.Azimuth
 WScript.Echo " Elevation   : " & objSat.Elevation
 WScript.Echo " Signal      : " & objSat.SignalNoiseRatio
 WScript.Echo " Used        : " & objSat.UsedForFix

 Set objSat = objGps.GetNextSatellite ()
WEnd


Azimuth property

Type:

Number

In/Out:

Out

Optional:

Yes

Description:

The azimuth of the current GPS satellite in degrees.

Code Sample:

...
Set objSat = objGps.GetFirstSatellite ()

While ( objGps.LastError = 0 )

 WScript.Echo "Info for satellite #" & objSat.ID
 WScript.Echo " Azimuth     : " & objSat.Azimuth
 WScript.Echo " Elevation   : " & objSat.Elevation
 WScript.Echo " Signal      : " & objSat.SignalNoiseRatio
 WScript.Echo " Used        : " & objSat.UsedForFix

 Set objSat = objGps.GetNextSatellite ()
WEnd


SignalNoiseRatio property

Type:

Number

In/Out:

Out

Optional:

Yes

Description:

The SNR (Signal Noise Ratio) of the current GPS satellite in dB (decibel).

Code Sample:

...
Set objSat = objGps.GetFirstSatellite ()

While ( objGps.LastError = 0 )

 WScript.Echo "Info for satellite #" & objSat.ID
 WScript.Echo " Azimuth     : " & objSat.Azimuth
 WScript.Echo " Elevation   : " & objSat.Elevation
 WScript.Echo " Signal      : " & objSat.SignalNoiseRatio
 WScript.Echo " Used        : " & objSat.UsedForFix

 Set objSat = objGps.GetNextSatellite ()
WEnd


UsedForFix property

Type:

Number

In/Out:

Out

Optional:

Yes

Description:

This property indicates whether this satellite was used for the current fix. If this value is TRUE it was used, if FALSE, the satellite is in view, but was not used for calculating the fix (yet).

Code Sample:

...
Set objSat = objGps.GetFirstSatellite ()

While ( objGps.LastError = 0 )

 WScript.Echo "Info for satellite #" & objSat.ID
 WScript.Echo " Azimuth     : " & objSat.Azimuth
 WScript.Echo " Elevation   : " & objSat.Elevation
 WScript.Echo " Signal      : " & objSat.SignalNoiseRatio
 WScript.Echo " Used        : " & objSat.UsedForFix

 Set objSat = objGps.GetNextSatellite ()
WEnd


Clear Function

Return Value:

Always 0.

Parameters:

None

Optional:

Yes

Description:

Use this function to clear all the values of the GpsSatelliteInfo object.

Code Sample:

...
Set objSat = objGps.GetFirstSatellite ()

While ( objGps.LastError = 0 )

 WScript.Echo "Info for satellite #" & objSat.ID
 WScript.Echo " Azimuth     : " & objSat.Azimuth
 WScript.Echo " Elevation   : " & objSat.Elevation
 WScript.Echo " Signal      : " & objSat.SignalNoiseRatio
 WScript.Echo " Used        : " & objSat.UsedForFix

 objSat.Clear ()

 Set objSat = objGps.GetNextSatellite ()
WEnd


The 'Gps' object

Overview

The Gps object is the core of the component, it handles the serial communication and the decoding of the received NMEA sentences.
Below is a list of all the properties of this object:

Object Properties

Property Name Type Description
Version String Can be used to retrieve the version of the control used
RegistrationCode String To activate your product, use this property to set the registrationcode received
Registered String Displays the number of days left for evaluation,
or just registered when the software has been purchased
LastError Number The result of the last operation (numeric error code)
LastErrorDescription String The result of the last operation (textual description)
LogFile String File used to log all operations and GPS data
DeviceSerialPort Number COMxx number of serial port the GPS is connected to
DeviceBaudrate Number Speed to be used on serial port
DeviceDataFormat Number Dataformat to be used on serial port (Databits, Parity, Stopbits)
DeviceTimeout Number Time in milliseconds after when the read operation will timeout
TalkerID String Only NMEA sentences with talker ID's as specified in this property will be decoded
Filter Number This property allows you to specify which types of sentences should be decoded,
and which are discarded
EnableChecksum Boolean Turn NMEA0183 CRC functionality on or off
UnitsSpeed Number Units used to represent speed (Knots, Kmh, mph)
UnitsAltitude Number Units used to represent altitude (feet, meters)
LatLonStringFormat Number Format used to display latitude and longitude in string format
LogGpsData Boolean Turn GPS data logging to file on or off
gpsLatitude Float Current Latitude
gpsLongitude Float Current Longitude
gpsAltitude Float Current Altitude
gpsSpeed Float Current Speed over Ground
gpsCourse Float Current Course over Ground
gpsMagneticVariation Float Current Magnetic Variation calculated by GPS
gpsTime Number Current (Atomic) GPS Time
gpsLatitudeString String Formatted Latitude String
gpsLongitudeString String Formatted Longitude String
gpsTimeString String Formatted GPS Time string
gpsQuality Number GPS fix quality indication
gpsSatellites Number Number of satellites used in fix
gpsDifferentialID Number ID of DGPS reference station
gpsDifferentialAge Number Age of DGPS reference station data
gpsPDOP Float Current PDOP
gpsHDOP Float Current HDOP
gpsVDOP Float Current VDOP
gpsEOPE Float Current estimated overall position error (Garmin only)
gpsEHPE Float Current estimated horizontal position error (Garmin only)
gpsEVPE Float Current estimated vertical position error (Garmin only)


Object Functions

Function Name Description
Clear Resets the values of all properties to their defaults
Open Opens the serial port, and start receiving and decoding incoming GPS data
Close Stop receiving and decoding GPS data, and close serial port
GetFirstSatellite Get information about the first satellite used for fix
GetNextSatellite Get information about the next satellite used for fix
Parse Parse a single line of NMEA0183 data


Version property

Type:

String

In/Out:

Out

Optional:

Yes

Description:

The version property can be used to print the version number of the GPS toolkit version currently used.

Code Sample:

Set objGps = CreateObject ( "Eye4Software.Gps" )

WScript.Echo objGps.Version


RegistrationCode property

Type:

String

In/Out:

In

Optional:

Yes

Description:

Use this property to activate the software. Once you purchased the software, you will receive a license code. Assign this code to this property to be able to use the software after the evaluation has been expired.

Code Sample:

Set objGps = CreateObject ( "Eye4Software.Gps" )

objGps.RegistrationCode = "XXXXXXXXXXXXXXXXXXXXXXXXXXX"


Registered property

Type:

Boolean

In/Out:

Out

Optional:

Yes

Description:

This value indicates whether the software has been activated. When the software has been successfully activated using the "RegistrationCode" property, or when the evaluation period has not been expired yet, it will return TRUE, otherwise FALSE.

Code Sample:

Set objGps = CreateObject ( "Eye4Software.Gps" )

If ( objGps.Registered = True ) Then
 Wscript.Echo "Registration OK"
Else
 WScript.Echo "Invalid license key, or trial has been expired"
End If


LastError property

Type:

Number

In/Out:

Out

Optional:

Yes

Description:

When one of the functions has been executed, this property returns the result code of this function. To get the description of this error, use the "LastErrorDescription" property instead.

Code Sample:

Set objGps = CreateObject ( "Eye4Software.Gps" )

objGps.DeviceSerialPort = 1

objGps.Open ()

WScript.Echo "Opening GPS device, result = " & objGps.LastError & " ( " & objGps.LastErrorDescription & " )"
...


LastErrorDescription property

Type:

Number

In/Out:

Out

Optional:

Yes

Description:

When one of the functions has been executed, this property returns the result code of this function. The result is displayed in textual format. To get the number of this error, use the "LastError" property instead.

Code Sample:

Set objGps = CreateObject ( "Eye4Software.Gps" )

objGps.DeviceSerialPort = 1

objGps.Open ()

WScript.Echo "Opening GPS device, result = " & objGps.LastError & " ( " & objGps.LastErrorDescription & " )"
...


LogFile property

Type:

String

In/Out:

In/Out

Optional:

Yes

Description:

Use this property to specify the file where all operations should be logged to perform troubleshooting. This is also the file where NMEA data is logged, in case the "LogNmeaData" property is set to TRUE.

Code Sample:

Set objGps = CreateObject ( "Eye4Software.Gps" )

objGps.LogFile = "C:\GpsLog.txt"

objGps.LogGpsData       = True
objGps.DeviceSerialPort = 1

objGps.Open ()
...


DeviceSerialPort property

Type:

Number

In/Out:

In/Out

Optional:

No

Description:

In order to read NMEA data from a serial port, you have to specify the serial port to use. Just set this property to the serial port the GPS device is connected to, for instance if you are using COM4, set the value of this property to "4".
When using a Garmin GPS connected using USB, set this property to zero to specify to use Garmin's USB driver instead of a serial port. When using this driver, the Garmin PVT protocol is used.

Code Sample:

Set objGps = CreateObject ( "Eye4Software.Gps" )

objGps.DeviceSerialPort = 4

objGps.Open ()
...


DeviceBaudrate property

Type:

Number

In/Out:

In/Out

Optional:

Yes

Description:

By default, a baudrate of 4800 bps is used on the serial port, because this speed is defined in the NMEA0183 standard. If your GPS device uses another baudrate, you can set it using this property. All standard baudrate values are supported ( 300 bps .. 115200 bps).
This property is ignored when the Garmin USB GPS driver is used.

Code Sample:

Set objGps = CreateObject ( "Eye4Software.Gps" )

objGps.DeviceSerialPort = 1
objGps.DeviceBaudrate   = 9600

objGps.Open ()
...


DeviceDataFormat property

Type:

Number

In/Out:

In/Out

Optional:

Yes

Description:

By default, the n81 dataformat is used (8 databits, no parity and 1 stopbit). If your GPS device is using another dataformat, you can set it using this property. Possible values are defined using the "DeviceFormat Constants".
This property is ignored when the Garmin USB GPS driver is used.

Code Sample:

Set objGps = CreateObject ( "Eye4Software.Gps" )
Set objCon = CreateObject ( "Eye4Software.GpsConstants" )

objGps.DeviceSerialPort = 1

objGps.DeviceBaudrate   = 9600
objGps.DeviceDataFormat = objCon.GPS_DEVICE_FORMAT_7E1

objGps.Open ()
...


DeviceTimeout property

Type:

Number

In/Out:

In/Out

Optional:

Yes

Description:

This property specifies the read timeout in milliseconds. The default value should work okay with most GPS devices, but in case you encounter incomplete received strings, increase this value.

Code Sample:

Set objGps = CreateObject ( "Eye4Software.Gps" )

objGps.DeviceSerialPort = 1

objGps.DeviceTimeOut    = 2000

objGps.Open ()
...


TalkerID property

Type:

String

In/Out:

In/Out

Optional:

Yes

Description:

The talker ID of a NMEA0183 string is used to identify the device which sent the string. For instance, when a GLL string is sent by a GPS device, the string will start with "$GPGLL", if a latlon string is forwarded by an echosounder, the string will start with "$DPGLL". Another example, when a VTG is calculated by the GPS, it is received as "$GPVTG", if it is determined by a compass, it is received as "$HCVTG". You can use this property to specify from which devices you want to decode data. If you only want to decode from GPS devices, just set this property to "GP". By default sentences with all talker ID's are decoded. Please find a list with possible Talker Identifiers below:
This property is ignored when the Garmin USB GPS driver is used. The protocol used in this case is Garmin PVT which does not use talker Id's

Talker ID Description
AG Autopilot - General
AP Autopilot - Magnetic
CD Communications - DSC
CR Communications - Receiver
CS Communications - Satellite
CT Communications - Radio-Telephone (MF/HF)
CV Communications - Radio-Telephone (VHF)
CX Communications - Scanning Receiver
DF Direction Finder
EC ECDIS
EP EPIRB
ER Engine Room Monitoring Systems
GP Global Positioning System (GPS)
HC Heading - Magnetic Compass
HE Heading - North Seeking Gyro
HN Heading - Non North Seeking Gyro
II Integrated Instrumentation
IN Integrated Navigation
LC Loran C
RA RADAR / ARPA
SD Sounder - Depth
SN Electronic Positioning System
SS Sounder - Scanning (SONAR)
TI Turn Rate Indicator
VD Velocity Sensor - Doppler
DM Velocity Sensor - Magnetic
VW Velocity Sensor - Mechanical
WI Weather Instruments
YX Transducer
ZA Timekeeper - Atomic Clock
ZC Timekeeper - Chronometer
ZQ Timekeeper - Quartz
ZV Timekeeper - Radio Update, WWV or WWVH

Code Sample:

Set objGps = CreateObject ( "Eye4Software.Gps" )
Set objCon = CreateObject ( "Eye4Software.GpsConstants" )

objGps.DeviceSerialPort = 1

objGps.TalkerID         = "GP;II"

objGps.Open ()
...


Filter property

Type:

Number

In/Out:

In/Out

Optional:

Yes

Description:

You can use the "Filter" property to tell the toolkit which sentences has to be decoded. By default all NMEA sentences are decoded, but if you want to force to decode some values from a specific string you can use this property (for instance when the GGA sentence is more precise then the GLL sentence). The sentences to decode are specified by using the "NmeaFilter Constants" as demonstrated in the code sample below:
This property is ignored when the Garmin USB GPS driver is used. The protocol used in this case is Garmin PVT which does not use NMEA sentences

Code Sample:

Set objGps = CreateObject ( "Eye4Software.Gps" )
Set objCon = CreateObject ( "Eye4Software.GpsConstants" )

objGps.DeviceSerialPort = 1

objGps.Filter		= objCon.GPS_NMEA_FILTER_GGA Or objCon.GPS_NMEA_FILTER_VTG

objGps.Open ()
...


EnableChecksum property

Type:

Boolean

In/Out:

In/Out

Optional:

Yes

Description:

Some GPS devices support CRC checking in the NMEA strings they sent. You can check for such strings by looking for a "*" with a 2 digit hex number at the end of the string. The CRC string is used to check whether there are no errors in the received data. The GPS toolkit can calculate the checksum and check if the string is okay, if not the string is discarded. To turn on this functionality, set this property to TRUE.
This property is ignored when the Garmin USB GPS driver is used. The protocol used in this case is Garmin PVT which has CRC checking built-in

Code Sample:

Set objGps = CreateObject ( "Eye4Software.Gps" )

objGps.DeviceSerialPort = 1

objGps.EnableChecksum   = TRUE

objGps.Open ()
...


UnitsSpeed property

Type:

Number

In/Out:

In/Out

Optional:

Yes

Description:

Use one of the "SpeedUnits Constants" to specify the units used for speeds. The default is: Knots.

Code Sample:

Set objGps = CreateObject ( "Eye4Software.Gps" )
Set objCon = CreateObject ( "Eye4Software.GpsConstants" )

objGps.DeviceSerialPort = 1

objGps.UnitsSpeed = objCon.GPS_SPEED_METERSPERSECOND

objGps.Open ()
...


UnitsAltitude property

Type:

Number

In/Out:

In/Out

Optional:

Yes

Description:

Use one of the "AltitudeUnits Constants" to specify the units used for altitudes. The default is: Meters.

Code Sample:

Set objGps = CreateObject ( "Eye4Software.Gps" )
Set objCon = CreateObject ( "Eye4Software.GpsConstants" )

objGps.DeviceSerialPort = 1

objGps.UnitsAltitude = objCon.GPS_ALTITUDE_FEET

objGps.Open ()
...


LatLonStringFormat property

Type:

Number

In/Out:

In/Out

Optional:

Yes

Description:

You can use this property to specify the format used in the "gpsLatitudeString" and "gpsLongitudeString property. You can set this property using one of the "LatLonFormat Constants".

Code Sample:

Set objGps = CreateObject ( "Eye4Software.Gps" )
Set objCon = CreateObject ( "Eye4Software.GpsConstants" )

objGps.DeviceSerialPort = 1

objGps.LatLonStringFormat = objCon.GPS_ALTITUDE_FEET

objGps.Open ()
...


LogGpsData property

Type:

Boolean

In/Out:

In/Out

Optional:

Yes

Description:

When this property is set to TRUE, all received NMEA0183 data will be appended to the specified logfile. See the "LogFile" property for more information on logfiles.
In case the Garmin USB driver is used to receive GPS data, a HEX dump of all received PVT data will be appended to the specified logfile.

Code Sample:

Set objGps = CreateObject ( "Eye4Software.Gps" )

objGps.LogFile = "C:\GpsLog.txt"

objGps.LogGpsData       = True
objGps.DeviceSerialPort = 1

objGps.Open ()
...


gpsLatitude property

Type:

Float

In/Out:

Out

Optional:

Yes

Description:

Use this property to retrieve the current latitude. The latitude is returned as a floating point value which can be used in calculations. If you need the Latitude formatted as a string, please have a look at the "gpsLatitudeString" property.

Code Sample:

Set objGps = CreateObject ( "Eye4Software.Gps" )
...
objGps.Open ()
...
Wscript.Echo "Longitude : " & objGps.gpsLongitude
WScript.Echo "Latitude  : " & objGps.gpsLatitude


gpsLongitude property

Type:

Float

In/Out:

Out

Optional:

Yes

Description:

Use this property to retrieve the current longitude. The longitude is returned as a floating point value which can be used in calculations. If you need the Latitude formatted as a string, please have a look at the "gpsLongitudeString" property.

Code Sample:

Set objGps = CreateObject ( "Eye4Software.Gps" )
...
objGps.Open ()
...
Wscript.Echo "Longitude : " & objGps.gpsLongitude
WScript.Echo "Latitude  : " & objGps.gpsLatitude


gpsAltitude property

Type:

Float

In/Out:

Out

Optional:

Yes

Description:

Use this property to retrieve the current altitude. The altitude is returned as a floating point value in meters or feet, depending on the setting of the "UnitsAltitude" property.

Code Sample:

Set objGps = CreateObject ( "Eye4Software.Gps" )
...
objGps.UnitsSpeed = objCon.GPS_ALTITUDE_FEET
...
objGps.Open ()
...
Wscript.Echo "Altitude  : " & objGps.gpsAltitude & " Feet"


gpsSpeed property

Type:

Float

In/Out:

Out

Optional:

Yes

Description:

Use this property to retrieve the current speed over ground. The altitude is returned as a floating point value in knots, meters per second, miles per hour, kilometers per hour, depending on the setting of the "UnitsSpeed" property.

Code Sample:

Set objGps = CreateObject ( "Eye4Software.Gps" )
...
objGps.UnitsSpeed = objCon.GPS_SPEED_KNOTS
...
objGps.Open ()
...
Wscript.Echo "Speed  : " & objGps.gpsSpeed & " Knots"


gpsCourse property

Type:

Float

In/Out:

Out

Optional:

Yes

Description:

Use this property to retrieve the current course over ground. The altitude is returned as a floating point value in degrees.

Code Sample:

Set objGps = CreateObject ( "Eye4Software.Gps" )
...
objGps.Open ()
...
Wscript.Echo "Course  : " & objGps.gpsCourse & " Degrees"


gpsMagneticVariation property

Type:

Float

In/Out:

Out

Optional:

Yes

Description:

Use this property to retrieve the magnetic variation. This value is returned as a floating point value in degrees.

The GPS receiver has to send the $GPRMC sentence in order to retrieve this value.

Code Sample:

Set objGps = CreateObject ( "Eye4Software.Gps" )
...
objGps.Open ()
...
If ( objGps.gpsMagneticVariation > 0 ) Then
  Wscript.Echo "Magnetic Variation  : " & objGps.gpsMagneticVariation & " Degrees East"
Else
  Wscript.Echo "Magnetic Variation  : " & objGps.gpsMagneticVariation & " Degrees West"
End If


gpsTime property

Type:

Number

In/Out:

Out

Optional:

Yes

Description:

Use this property to retrieve the currect atomic GPS time from the GPS device. Time is presented in seconds since the epoch ( 1/1/1970 00:00 ). If you want the formatted time, use the "gpsTimeString" property instead.

Code Sample:

Set objGps = CreateObject ( "Eye4Software.Gps" )
...

objGps.Open ()
...
Wscript.Echo "Time  : " & objGps.gpsTime & " Seconds since epoch"


gpsQuality property

Type:

Number

In/Out:

Out

Optional:

Yes

Description:

This property indicates the type of fix ( or no fix ) of the GPS device. Possible values are:

Value Description
0 No Fix
1 GPS fix
2 DGPS fix (Differential GPS)
3 PPS fix
4 RTK fix (Real Time Kinematic)
5 Float RTK
6 Dead Reckoning (estimated)
7 Manual input mode
8 Simulation mode
   

Code Sample:

Set objGps = CreateObject ( "Eye4Software.Gps" )
...
objGps.Open ()
...
WScript.Echo "GPS Quality: "& objGps.gpsQuality


gpsSatellites property

Type:

Number

In/Out:

Out

Optional:

Yes

Description:

Use this property to retrieve the number of satellites used for the current fix.

Code Sample:

Set objGps = CreateObject ( "Eye4Software.Gps" )
...
objGps.Open ()
...
WScript.Echo "GPS Satellites Used: "& objGps.gpsSatellites


gpsDifferentialID property

Type:

Number

In/Out:

Out

Optional:

Yes

Description:

Use this property to retrieve the ID of the DGPS base station used when DGPS or RTK is used.

Code Sample:

Set objGps = CreateObject ( "Eye4Software.Gps" )
...
objGps.Open ()
...
WScript.Echo "GPS Beacon ID: "& objGps.gpsDifferentialID


gpsDifferentialAge property

Type:

Number

In/Out:

Out

Optional:

Yes

Description:

Use this property to retrieve the age of the DGPS data currently used for fix. When this data is getting older, and now new information is received, the position will become more inaccurate.

Code Sample:

Set objGps = CreateObject ( "Eye4Software.Gps" )
...
objGps.Open ()
...
WScript.Echo "DGPS Beacon Data Age: "& objGps.gpsDifferentialAge


gpsPDOP property

Type:

Float

In/Out:

Out

Optional:

Yes

Description:

Use this property to retrieve the PDOP (Position Dilution Of Position) from the GPS device.

Code Sample:

Set objGps = CreateObject ( "Eye4Software.Gps" )
...
objGps.DeviceSerialPort = 1

objGps.Open ()
...
WScript.Echo "PDOP: " & objGps.gpsPDOP
WScript.Echo "VDOP: " & objGps.gpsVDOP
WScript.Echo "HDOP: " & objGps.gpsHDOP


gpsHDOP property

Type:

Float

In/Out:

Out

Optional:

Yes

Description:

Use this property to retrieve the HDOP (Horizontal Dilution Of Position) from the GPS device.

Code Sample:

Set objGps = CreateObject ( "Eye4Software.Gps" )
...
objGps.DeviceSerialPort = 1

objGps.Open ()
...
WScript.Echo "PDOP: " & objGps.gpsPDOP
WScript.Echo "VDOP: " & objGps.gpsVDOP
WScript.Echo "HDOP: " & objGps.gpsHDOP


gpsVDOP property

Type:

Float

In/Out:

Out

Optional:

Yes

Description:

Use this property to retrieve the VDOP (Vertical Dilution Of Position) from the GPS device.

Code Sample:

Set objGps = CreateObject ( "Eye4Software.Gps" )
...
objGps.DeviceSerialPort = 1

objGps.Open ()
...
WScript.Echo "PDOP: " & objGps.gpsPDOP
WScript.Echo "VDOP: " & objGps.gpsVDOP
WScript.Echo "HDOP: " & objGps.gpsHDOP


gpsEOPE property

Type:

Float

In/Out:

Out

Optional:

Yes

Description:

Use this property to retrieve the estimated overall position error from the GPS device.
This error is always returned in meters.
This property only contains a value when using a Garmin GPS device or any other device device which supports Garmin's $PGRME NMEA sentence.

Code Sample:

Set objGps = CreateObject ( "Eye4Software.Gps" )
...
objGps.DeviceSerialPort = 1

objGps.Open ()
...
WScript.Echo "Estimated Overall Position Error    : " & objGps.gpsEOPE
WScript.Echo "Estimated Vertical Position Error   : " & objGps.gpsEVPE
WScript.Echo "Estimated Horizontal Position Error : " & objGps.gpsEHPE


gpsEHPE property

Type:

Float

In/Out:

Out

Optional:

Yes

Description:

Use this property to retrieve the estimated horizontal position error from the GPS device.
This error is always returned in meters.
This property only contains a value when using a Garmin GPS device or any other device device which supports Garmin's $PGRME NMEA sentence.

Code Sample:

Set objGps = CreateObject ( "Eye4Software.Gps" )
...
objGps.DeviceSerialPort = 1

objGps.Open ()
...
WScript.Echo "Estimated Overall Position Error    : " & objGps.gpsEOPE
WScript.Echo "Estimated Vertical Position Error   : " & objGps.gpsEVPE
WScript.Echo "Estimated Horizontal Position Error : " & objGps.gpsEHPE


gpsEVPE property

Type:

Float

In/Out:

Out

Optional:

Yes

Description:

Use this property to retrieve the estimated vertical position error from the GPS device.
This error is always returned in meters.
This property only contains a value when using a Garmin GPS device or any other device device which supports Garmin's $PGRME NMEA sentence.

Code Sample:

Set objGps = CreateObject ( "Eye4Software.Gps" )
...
objGps.DeviceSerialPort = 1

objGps.Open ()
...
WScript.Echo "Estimated Overall Position Error    : " & objGps.gpsEOPE
WScript.Echo "Estimated Vertical Position Error   : " & objGps.gpsEVPE
WScript.Echo "Estimated Horizontal Position Error : " & objGps.gpsEHPE


Clear Function

Return Value:

Always 0. Use the "LastError" or "LastErrorDescription" properties to get the result of the operation.

Parameters:

None

Optional:

Yes

Description:

Use this function to reset all the object's properties to its default values.

Code Sample:

Set objGps = CreateObject ( "Eye4Software.Gps" )
...
objGps.DeviceBaudrate = 115200

objGps.Clear ()
...
WScript.Echo objGps.DeviceBaudrate 'Should return 4800


Open Function

Return Value:

Always 0 or S_OK. Use the "LastError" or "LastErrorDescription" properties to get the result of the operation.

Parameters:

None

Optional:

No

Description:

When the Open function is called, the toolkit will attempt to open the serial port, and start reading and decoding NMEA0183 data from the GPS device. You can stop decoding and close the serial port using the "Close" function.
To communicate directly to the Garmin USB driver, set this property to zero.

Code Sample (Serial):

Set objGps = CreateObject ( "Eye4Software.Gps" )
...
objGps.DeviceSerialPort = 1
objGps.DeviceBaudrate   = 4800
...
objGps.Open ()
...

Code Sample (Garmin USB):

Set objGps = CreateObject ( "Eye4Software.Gps" )
...
objGps.DeviceSerialPort = 0
...
objGps.Open ()
...


Close Function

Return Value:

Always 0 (S_OK). Use the "LastError" or "LastErrorDescription" properties to get the result of the operation.

Parameters:

None

Optional:

Yes

Description:

If started, the Close function will stop the toolkit reading and decoding NMEA0183 or PVT data, and close the serial port or communications to the Garmin driver. To start reading and decoding data again, use the "Open" function.

Code Sample:

Set objGps = CreateObject ( "Eye4Software.Gps" )
...
objGps.DeviceBaudrate = 115200

objGps.Clear ()
...
WScript.Echo objGps.DeviceBaudrate 'Should return 4800


GetFirstSatellite Function

Return Value:

Always 0. Use the "LastError" or "LastErrorDescription" properties to get the result of the operation.

Parameters:

None

Optional:

Yes

Description:

Use this function to get information about the GPS satellites used for fix calculation. This function returns the first object in the enumeration. After calling GetFirstSatellite, you have to use "GetNextSatellite" while the "LastError" property is equal to zero.

Code Sample:

...
Set objSat = objGps.GetFirstSatellite ()

While ( objGps.LastError = 0 )

 WScript.Echo "Info for satellite #" & objSat.ID
 WScript.Echo " Azimuth     : " & objSat.Azimuth
 WScript.Echo " Elevation   : " & objSat.Elevation
 WScript.Echo " Signal      : " & objSat.SignalNoiseRatio
 WScript.Echo " Used        : " & objSat.UsedForFix

 Set objSat = objGps.GetNextSatellite ()
WEnd


GetNextSatellite Function

Return Value:

Always 0. Use the "LastError" or "LastErrorDescription" properties to get the result of the operation.

Parameters:

None

Optional:

Yes

Description:

Use this function after the call to "GetFirstSatellite" to get information about the other GPS satellites used for fix calculation. You have to call "GetNextSatellite" while the "LastError" property is equal to zero..

Code Sample:

...
Set objSat = objGps.GetFirstSatellite ()

While ( objGps.LastError = 0 )

 WScript.Echo "Info for satellite #" & objSat.ID
 WScript.Echo " Azimuth     : " & objSat.Azimuth
 WScript.Echo " Elevation   : " & objSat.Elevation
 WScript.Echo " Signal      : " & objSat.SignalNoiseRatio
 WScript.Echo " Used        : " & objSat.UsedForFix

 Set objSat = objGps.GetNextSatellite ()
WEnd


Parse Function

Return Value:

Always 0. Use the "LastError" or "LastErrorDescription" property to get the result of the operation.

Parameters:

A string containing a line of NMEA0183 data

Optional:

Yes

Description:

Use this function to parse a single line of NMEA 0183 data. This is usefull when you wish to decode GPS data retrieved from something other then a GPS device, for instance, when data is retrieved from a file or network connection. When the Parse function completes, it will set the same properties as when using a GPS device.

Code Sample:

Set objGps    = CreateObject ( "Eye4Software.Gps" )

objGps.Parse ( "$GPGGA,123244,5209.6851,N,00643.0712,E,1,09,1.0,32.3,M,46.7,M,,*7E" )

WScript.Echo ( "Latitude  = " & objGps.gpsLatitudeString  )
WScript.Echo ( "Longitude = " & objGps.gpsLongitudeString )
WScript.Echo ( "Altitude  = " & objGps.gpsAltitude )


The 'GpsDatumParameters' object

Overview

The GpsDatumParameters object is used to store all parameters of a specific map datum. This map datum is used to pass to a GpsGridParamaters object when a transormation from one grid to another is performed, or to pass to the TransformDatum function of the GpsProjection project, when performing a tranformation between one map datum and another.

After creation, the GpsDatumParameters object holds both ellipsoid and the Helmert-7 parameters used to transform to WGS84.

Using the LoadFromId function, you can load one of the 300 predefined map datums available in the toolkit.

Object Properties

Property Name Type Description
Id Number Id number under which this datum is stored in the internal database
Name Float Name of the datum (when selected from the internal database)
Axis Float Semi-major axis of the ellipsoid used for this map datum
Flattening Float Flattening of the ellipsoid used for this map datum
TranslationX Float X translation to transform to WGS84, in meters
TranslationY Float Y translation to transform to WGS84, in meters
TranslationZ Float Z translation to transform to WGS84, in meters
RotationX Float X rotation to transform to WGS84, in arcseconds
RotationY Float Y rotation to transform to WGS84, in arcseconds
RotationZ Float Z rotation to transform to WGS84, in arcseconds
RotationZ Float Z rotation to transform to WGS84, in arcseconds
ScaleFactor Float Scalefactor in ppm (parts per million or e-06)
PrimeMeridian Float Prime meridian used with this datum
GridType Number Type of datum shift file to use
Grid Number Filename of datum shift file to use


Object Functions

Function Name Description
Clear Clears all property values
LoadFromId Loads a predefined map datum
GetFirstDatum Retrieves the first map datum record from the internal database
GetNextDatum Retrieves the next map datum record from the internal database
SaveToFile Saves all property values to a file
LoadFromFile Reads all property values from a file


Id property

Type:

Number

In/Out:

Out

Optional:

Yes

Description:

The EPSG code for this map datum. Use this code to load a datum using the LoadFromId function.

Code Sample:

Dim objDatum

Set objDatum = CreateObject ( "Eye4Software.GpsDatumParameters" )

objDatum.GetFirstDatum

While ( objDatum.LastError = 0 )
  WScript.Echo "Datum: " & objDatum.Name & " (EPSG:" & objDatum.Id & ")"
  objDatum.GetNextDatum
WEnd


Name property

Type:

String

In/Out:

Out

Optional:

Yes

Description:

The name of this map datum. This name is only set when the datum is a build-in datum of the toolkit.

Code Sample:

Dim objDatum

Set objDatum = CreateObject ( "Eye4Software.GpsDatumParameters" )

objDatum.GetFirstDatum

While ( objDatum.LastError = 0 )
  WScript.Echo "Datum: " & objDatum.Name & " (EPSG:" & objDatum.Id & ")"
  objDatum.GetNextDatum
WEnd


Axis property

Type:

Float

In/Out:

In/Out

Optional:

Yes

Description:

The semi-major axis of the ellipsoid defined for this datum.

Code Sample:

Dim objDatum

Set objDatum = CreateObject ( "Eye4Software.GpsDatumParameters" )

objDatum.Axis         = 6378137.000
objDatum.Flattening   = 298.257223563


Flattening property

Type:

Float

In/Out:

In/Out

Optional:

Yes

Description:

The flattening of the ellipsoid defined for this map datum.

Code Sample:

Dim objDatum

Set objDatum = CreateObject ( "Eye4Software.GpsDatumParameters" )

objDatum.Axis         = 6378137.000
objDatum.Flattening   = 298.257223563


TranslationX property

Type:

Float

In/Out:

In/Out

Optional:

Yes

Description:

The X translation in meters used to convert from this map datum to WGS84. The GPS toolkit uses the Helmert-7 parameters.

Code Sample:

Dim objDatum

Set objDatum = CreateObject ( "Eye4Software.GpsDatumParameters" )

objDatum.Axis         = 6378137.000
objDatum.Flattening   = 298.257223563

objDatum.TranslationX =  -56.263
objDatum.TranslationY =   16.136
objDatum.TranslationZ =  -22.856


TranslationY property

Type:

Float

In/Out:

In/Out

Optional:

Yes

Description:

The Y translation in meters used to convert from this map datum to WGS84. The GPS toolkit uses the Helmert-7 parameters.

Code Sample:

Dim objDatum

Set objDatum = CreateObject ( "Eye4Software.GpsDatumParameters" )

objDatum.Axis         = 6378137.000
objDatum.Flattening   = 298.257223563

objDatum.TranslationX =  -56.263
objDatum.TranslationY =   16.136
objDatum.TranslationZ =  -22.856


TranslationZ property

Type:

Float

In/Out:

In/Out

Optional:

Yes

Description:

The Z translation in meters used to convert from this map datum to WGS84. The GPS toolkit uses the Helmert-7 parameters.

Code Sample:

Dim objDatum

Set objDatum = CreateObject ( "Eye4Software.GpsDatumParameters" )

objDatum.Axis         = 6378137.000
objDatum.Flattening   = 298.257223563

objDatum.TranslationX =  -56.263
objDatum.TranslationY =   16.136
objDatum.TranslationZ =  -22.856


RotationX property

Type:

Float

In/Out:

In/Out

Optional:

Yes

Description:

The X rotation in arc seconds used to convert from this map datum to WGS84. The GPS toolkit uses Helmert-7 parameters.

Code Sample:

Dim objDatum

Set objDatum = CreateObject ( "Eye4Software.GpsDatumParameters" )

objDatum.Axis         = 6377340.189
objDatum.Flattening   = 299.324965463529

objDatum.TranslationX =  446.448
objDatum.TranslationY = -125.157
objDatum.TranslationZ =  542.060

objDatum.RotationX    = 0.150
objDatum.RotationY    = 0.247
objDatum.RotationZ    = 0.842

objDatum.ScaleFactor  = -20.4894


RotationY property

Type:

Float

In/Out:

In/Out

Optional:

Yes

Description:

The Y rotation in arc seconds used to convert from this map datum to WGS84. The GPS toolkit uses Helmert-7 parameters.

Code Sample:

Dim objDatum

Set objDatum = CreateObject ( "Eye4Software.GpsDatumParameters" )

objDatum.Axis         = 6377340.189
objDatum.Flattening   = 299.324965463529

objDatum.TranslationX =  446.448
objDatum.TranslationY = -125.157
objDatum.TranslationZ =  542.060

objDatum.RotationX    = 0.150
objDatum.RotationY    = 0.247
objDatum.RotationZ    = 0.842

objDatum.ScaleFactor  = -20.4894


RotationZ property

Type:

Float

In/Out:

In/Out

Optional:

Yes

Description:

The Z rotation in arc seconds used to convert from this map datum to WGS84. The GPS toolkit uses Helmert-7 parameters.

Code Sample:

Dim objDatum

Set objDatum = CreateObject ( "Eye4Software.GpsDatumParameters" )

objDatum.Axis         = 6377340.189
objDatum.Flattening   = 299.324965463529

objDatum.TranslationX =  446.448
objDatum.TranslationY = -125.157
objDatum.TranslationZ =  542.060

objDatum.RotationX    = 0.150
objDatum.RotationY    = 0.247
objDatum.RotationZ    = 0.842

objDatum.ScaleFactor  = -20.4894


ScaleFactor property

Type:

Float

In/Out:

In/Out

Optional:

Yes

Description:

The scalefactor in ppm used to convert from this map datum to WGS84. The GPS toolkit uses the Helmert-7 parameters.
The scalefactor has to be set in ppm, for instance: if the scalefactor is specified as 4.0773e-06, you have to enter 4.0773.

Code Sample:

Dim objDatum

Set objDatum = CreateObject ( "Eye4Software.GpsDatumParameters" )

objDatum.Axis         = 6377340.189
objDatum.Flattening   = 299.324965463529

objDatum.TranslationX =  446.448
objDatum.TranslationY = -125.157
objDatum.TranslationZ =  542.060

objDatum.RotationX    = 0.150
objDatum.RotationY    = 0.247
objDatum.RotationZ    = 0.842

objDatum.ScaleFactor  = -20.4894


PrimeMeridian property

Type:

Float

In/Out:

In/Out

Optional:

Yes

Description:

The longitude in degrees of the prime meridian used for this map datum. Most datums use Greenwich which is 0.0. If unsure, please do not alter.

Code Sample:

Dim objDatum

Set objDatum = CreateObject ( "Eye4Software.GpsDatumParameters" )

objDatum.Axis           = 6377397.155
objDatum.Flattening     = 299.1528128
objDatum.PrimeMeridian  = -17.6666667 '  Ferro


GridType

Type:

Nunber

In/Out:

In/Out

Optional:

Yes

Description:

In case you want to use a grid shift file to perform datum transformations, set this parameter. By default this parameter is set to "0" which means that no grid shift will be loaded.

Code Sample:

Dim objDatum

Set objDatum = CreateObject ( "Eye4Software.GpsDatumParameters" )

objDstDatum.LoadFromId (4267)

objDstDatum.GridType    = objConstants.GPS_GRIDTYPE_NADCON
objDstDatum.Grid        = "C:\Program Files (x86)\Eye4Software\GpsToolkit\Nadcon\conus.los"


Grid property

Type:

String

In/Out:

In/Out

Optional:

Yes

Description:

Use this property to specify the grid shift file to use in datum conversions. You have to specify the full path to the file. When the GridType property is set to zero, this setting will be ignored.

Code Sample:

Dim objDatum

Set objDatum = CreateObject ( "Eye4Software.GpsDatumParameters" )

objDstDatum.LoadFromId (4267)

objDstDatum.GridType    = objConstants.GPS_GRIDTYPE_NADCON
objDstDatum.Grid        = "C:\Program Files (x86)\Eye4Software\GpsToolkit\Nadcon\conus.los"


Clear Function

Return Value:

Always 0.

Parameters:

None

Optional:

Yes

Description:

Use this function to resets all the values of the GpsDatumParameters object to WGS84 datum parameters.

Code Sample:

Dim objDatum

Set objDatum = CreateObject ( "Eye4Software.GpsDatumParameters" )

objDatum.Clear

objDatum.Axis         = 6377340.189
objDatum.Flattening   = 299.324965463529

objDatum.TranslationX =  446.448
objDatum.TranslationY = -125.157
objDatum.TranslationZ =  542.060

objDatum.RotationX    = 0.150
objDatum.RotationY    = 0.247
objDatum.RotationZ    = 0.842

objDatum.ScaleFactor  = -20.4894


LoadFromId Function

Return Value:

Always 0.

Parameters:

Map Datum ID

Optional:

Yes

Description:

Use this function to initialize the GpsDatumParameters with one of the 300 built in map datum available in the GPS toolkit. By using this function, you do not have to set all datum parameters manually. For a list of all supported map datums, click here.

Code Sample:

Dim objDatum

Set objDatum = CreateObject ( "Eye4Software.GpsDatumParameters" )

' Use NAD27 Datum
objDatum.LoadFromId ( 4267 )


GetFirstDatum and GetNextDatum Functions

Return Value:

Always 0.

Parameters:

None

Optional:

Yes

Description:

Use these functions to enumerate all build in map datums of the GPS Toolkit. You first have to call GetFirstDatum. While the LastError property is zero, you can call GetNextDatum to load the next available datum. Use the objects properties to retrieve information about the loaded map datum.

Code Sample:

Dim objDatum

Set objDatum = CreateObject ( "Eye4Software.GpsDatumParameters" )

objDatum.GetFirstDatum

While ( objDatum.LastError = 0 )
  WScript.Echo "Datum Id   : " & objDatum.Id
  WScript.Echo "Datum Name : " & objDatum.Name
 
  ...
  
  objDatum.GetNextDatum
WEnd


SaveToFile Function

Return Value:

Always 0.

Parameters:

FileName

Optional:

Yes

Description:

Using this function you can save all the values of the GpsDatumParameters object to a config file, so you can use the same data again through the LoadFromFile function.

Code Sample:

Dim objDatum

Set objDatum = CreateObject ( "Eye4Software.GpsDatumParameters" )

objDatum.Clear

objDatum.Axis         = 6377340.189
objDatum.Flattening   = 299.324965463529

objDatum.TranslationX =  446.448
objDatum.TranslationY = -125.157
objDatum.TranslationZ =  542.060

objDatum.RotationX    = 0.150
objDatum.RotationY    = 0.247
objDatum.RotationZ    = 0.842

objDatum.ScaleFactor  = -20.4894

objDatum.SaveToFile   "C:\Datums\OSGB36.ini"


LoadFromFile Function

Return Value:

Always 0.

Parameters:

FileName

Optional:

Yes

Description:

Use this function to read all the values of the GpsDatumParameters object from a file.

Code Sample:

Dim objDatum

Set objDatum = CreateObject ( "Eye4Software.GpsDatumParameters" )

objDatum.LoadFromFile "C:\Datums\OSGB36.ini"

WScript.Echo objDatum.Axis
WScript.Echo objDatum.Flattening

WScript.Echo objDatum.TranslationX
WScript.Echo objDatum.TranslationY
WScript.Echo objDatum.TranslationZ

WScript.Echo objDatum.RotationX
WScript.Echo objDatum.RotationY
WScript.Echo objDatum.RotationZ

WScript.Echo objDatum.ScaleFactor


The 'GpsGridParameters' object

Overview

The GpsGridParameters object is used to store all parameters of a specific map grid. This map grid object is used to pass to the TransformGrid function of the GpsProjection project, when performing a tranformation between one map grid and another.

The GpsGridParameters object holds projection specific parameters like the false easting and northing, parallels, scalefactor and latitude and or longitude of origin.

Using the LoadFromId function, you do not have to set all these parameters by yourself. This function initializes the object with one of the 3500 built in map grid definitions. The following table shows which parameters are used for the different projection types:

Projection SCALE FALSE_N FALSE_E LAT_0 LON_0 PAR_1 PAR_2 AZI RECTGRD
Lambert Conformal Conic 1 SP x x x x x - - - -
Lambert Conformal Conic 2 SP - x x x x x x - -
Lambert Azimuthal Equal Area - x x x x x x - -
Transverse Mercator x x x x x - - - -
Oblique Stereographic x x x x x - - - -
Polar Stereographic - x x x x - - - -
Oblique Mercator - x x x x - - - -
Hotine Oblique Mercator - x x x x - - x x
Swiss Oblique Mercator - x x x x - - - -
Albers Equal Area Conic - x x x x x x - -
Mercator 1SP x x x x x - - - -
Mercator 2SP - x x x x x - - -
Mollweide - x x - x - - - -
Eckert IV - x x - x - - - -
Eckert VI - x x - x - - - -
Cassini - x x x x - - - -
Krovak x x x x x x - x -

Object Properties

Property Name Type Description
Id Number The IPSG id of the currently loaded map grid
Name Name The name of the currently loaded map grid
Datum Object A GpsDatumParameters object, containing the definitions of the datum of this grid
Projection Number Projection algorithm used to calculate this grid
Units Number Units used for Easting and Northing values
ScaleFactor Float Scalefactor used to calculate this grid
FalseEasting Float False Easting (or X offset)
FalseNorthing Float False Northing (or Y offset)
OriginLatitude Float Latitude of origin
OriginLongitude Float Longitude of origin
ParallelNorth Float First of north parallel
ParallelSouth Float Second or south parallel
AzimuthAngle Float Azimuth Angle
RectifiedGridAngle Float Rectified Grid angle


Object Functions

Function Name Description
Clear Clears all property values
GetFirstGrid Loads the first build-in map grid
GetNextGrid Loads the next build-in map grid (if available)
LoadFromId Loads one of the built in map grids
LoadStatePlane Loads one of the built in U.S. State Plane Coordinate Systems
SaveToFile Save all property values to disk
LoadFromFile Read all property values from disk


Datum property

Type:

Object

In/Out:

In/Out

Optional:

No

Description:

The map datum associated with the grid you want to use. The datum is passed to this property as a GpsDatumParameters object.

Code Sample:

Dim objDatum, objGrid

Set objDatum     = CreateObject ( "Eye4Software.GpsDatumParameters" )
Set objGrid      = CreateObject ( "Eye4Software.GpsGridParameters" )

objDatum.Axis         =  6378388.0
objDatum.flattening   =  297.0

objDatum.TranslationX =  -87.0
objDatum.TranslationY =  -98.0
objDatum.TranslationZ = -121.0

objGrid.Datum         = objDatum


Projection property

Type:

Number

In/Out:

In/Out

Optional:

No

Description:

The projection you want to calculate the grid. Supported projections include: Lambert Conformal Conic 1SP, Lambert Conformal Conic 2SP, Lambert Azimuthal Equal Area, Transverse Mercator, Stereographic, Polar Stereographic, Albers Equal Area, Krovak and none (no grid at all, just latitude and longitude).
The constants for these and more projections are defined in the GpsConstants object.

Code Sample:

Dim objGrid, objConstants

Set objGrid      = CreateObject ( "Eye4Software.GpsGridParameters" )
Set objConstants = CreateObject ( "Eye4Software.GpsConstants" )

objGrid.Projection      = objConstants.GPS_PROJECTION_STEREOGRAPHIC

objGrid.ScaleFactor     = 0.999908

objGrid.FalseNorthing   = 463000.00
objGrid.FalseEasting    = 155000.00

objGrid.OriginLatitude  = 52.156161
objGrid.OriginLongitude = 5.387639


Units property

Type:

Number

In/Out:

In/Out

Optional:

Yes

Description:

Unit used to specify Northing and Easting values (and also False Easting and False Northing).
The constants for these projections are defined in the GpsConstants object.
By default, meters are used for Easting and Northing output.

Code Sample:

Dim objGrid, objConstants

Set objGrid      = CreateObject ( "Eye4Software.GpsGridParameters" )
Set objConstants = CreateObject ( "Eye4Software.GpsConstants" )

objGrid.Projection      = objConstants.GPS_PROJECTION_LAMBERT2SP

objGrid.FalseNorthing   = 5400088.438000
objGrid.FalseEasting    = 150000.012560

objGrid.ParallelNorth   = 49.833334
objGrid.ParallelSouth   = 51.166667

objGrid.OriginLatitude  = 90.0
objGrid.OriginLongitude = 4.367487

objGrid.Units			= objConstants.GPS_PROJECTION_UNITS_FTCLA


ScaleFactor property

Type:

Float

In/Out:

In/Out

Optional:

Yes

Description:

The scalefactor used to calculate the position within the grid. Note: the scalefactor has to be specified in ppm, for instance, when the scale factor is 4.0772e-06, you have to specify just 4.0772..

Code Sample:

Dim objGrid, objConstants

Set objGrid      = CreateObject ( "Eye4Software.GpsGridParameters" )
Set objConstants = CreateObject ( "Eye4Software.GpsConstants" )

objGrid.Projection      = objConstants.GPS_PROJECTION_STEREOGRAPHIC

objGrid.ScaleFactor     = 0.999908

objGrid.FalseNorthing   = 463000.00
objGrid.FalseEasting    = 155000.00

objGrid.OriginLatitude  = 52.156161
objGrid.OriginLongitude = 5.387639


False Northing property

Type:

Number

In/Out:

In/Out

Optional:

Yes

Description:

The false northing used to calculated the position within the grid. This parameter is also used to specify delta-Y.
The FalseNorthing property can be used for any projection, except for the latitude / longitude grid.

Code Sample:

Dim objGrid, objConstants

Set objGrid      = CreateObject ( "Eye4Software.GpsGridParameters" )
Set objConstants = CreateObject ( "Eye4Software.GpsConstants" )

objGrid.Projection      = objConstants.GPS_PROJECTION_STEREOGRAPHIC

objGrid.ScaleFactor     = 0.999908

objGrid.FalseNorthing   = 463000.00
objGrid.FalseEasting    = 155000.00

objGrid.OriginLatitude  = 52.156161
objGrid.OriginLongitude = 5.387639


FalseEasting property

Type:

Float

In/Out:

In/Out

Optional:

No

Description:

The false easting used to calculated the position within the grid. This parameter is also used to specify delta-X.
The FalseEasting property can be used for any projection, except for the latitude / longitude grid.

Code Sample:

Dim objGrid, objConstants

Set objGrid      = CreateObject ( "Eye4Software.GpsGridParameters" )
Set objConstants = CreateObject ( "Eye4Software.GpsConstants" )

objGrid.Projection      = objConstants.GPS_PROJECTION_STEREOGRAPHIC

objGrid.ScaleFactor     = 0.999908

objGrid.FalseNorthing   = 463000.00
objGrid.FalseEasting    = 155000.00

objGrid.OriginLatitude  = 52.156161
objGrid.OriginLongitude = 5.387639


OriginLatitude property

Type:

Number

In/Out:

In/Out

Optional:

No

Description:

The latitude of origin for this grid, in degrees.
The OriginLatitude property can be used for any projection, except for the latitude / longitude grid.

Code Sample:

Dim objGrid, objConstants

Set objGrid      = CreateObject ( "Eye4Software.GpsGridParameters" )
Set objConstants = CreateObject ( "Eye4Software.GpsConstants" )

objGrid.Projection      = objConstants.GPS_PROJECTION_STEREOGRAPHIC

objGrid.ScaleFactor     = 0.999908

objGrid.FalseNorthing   = 463000.00
objGrid.FalseEasting    = 155000.00

objGrid.OriginLatitude  = 52.156161
objGrid.OriginLongitude = 5.387639


OriginLongitude property

Type:

Float

In/Out:

In/Out

Optional:

No

Description:

The longitude of origin for this grid, in degrees.
The OriginLongitude property can be used for any projection, except for the latitude / longitude grid.

Code Sample:

Dim objGrid, objConstants

Set objGrid      = CreateObject ( "Eye4Software.GpsGridParameters" )
Set objConstants = CreateObject ( "Eye4Software.GpsConstants" )

objGrid.Projection      = objConstants.GPS_PROJECTION_STEREOGRAPHIC

objGrid.ScaleFactor     = 0.999908

objGrid.FalseNorthing   = 463000.00
objGrid.FalseEasting    = 155000.00

objGrid.OriginLatitude  = 52.156161
objGrid.OriginLongitude = 5.387639


ParallelNorth property

Type:

Float

In/Out:

In/Out

Optional:

Yes

Description:

The 1st or north parallel latitude for this grid, in degrees.
The ParallelNorth property can only be used for the Lambert projections.

Code Sample:

Dim objGrid, objConstants

Set objGrid      = CreateObject ( "Eye4Software.GpsGridParameters" )
Set objConstants = CreateObject ( "Eye4Software.GpsConstants" )

objGrid.Projection      = objConstants.GPS_PROJECTION_LAMBERT2SP

objGrid.FalseNorthing   = 5400088.438000
objGrid.FalseEasting    = 150000.012560

objGrid.ParallelNorth   = 49.833334
objGrid.ParallelSouth   = 51.166667

objGrid.OriginLatitude  = 90.0
objGrid.OriginLongitude = 4.367487


ParallelSouth property

Type:

Float

In/Out:

In/Out

Optional:

Yes

Description:

The 2nd or south parallel latitude for this grid, in degrees.
The ParallelSouth property can only be used for the Lambert projections.

Code Sample:

Dim objGrid, objConstants

Set objGrid      = CreateObject ( "Eye4Software.GpsGridParameters" )
Set objConstants = CreateObject ( "Eye4Software.GpsConstants" )

objGrid.Projection      = objConstants.GPS_PROJECTION_LAMBERT2SP

objGrid.FalseNorthing   = 5400088.438000
objGrid.FalseEasting    = 150000.012560

objGrid.ParallelNorth   = 49.833334
objGrid.ParallelSouth   = 51.166667

objGrid.OriginLatitude  = 90.0
objGrid.OriginLongitude = 4.367487


ParallelNorth property

Type:

Float

In/Out:

In/Out

Optional:

Yes

Description:

The 1st or north parallel latitude for this grid, in degrees.
The ParallelNorth property can only be used for the Lambert projections.

Code Sample:

Dim objGrid, objConstants

Set objGrid      = CreateObject ( "Eye4Software.GpsGridParameters" )
Set objConstants = CreateObject ( "Eye4Software.GpsConstants" )

objGrid.Projection      = objConstants.GPS_PROJECTION_LAMBERT2SP

objGrid.FalseNorthing   = 5400088.438000
objGrid.FalseEasting    = 150000.012560

objGrid.ParallelNorth   = 49.833334
objGrid.ParallelSouth   = 51.166667

objGrid.OriginLatitude  = 90.0
objGrid.OriginLongitude = 4.367487


ParallelSouth property

Type:

Float

In/Out:

In/Out

Optional:

Yes

Description:

The 2nd or south parallel latitude for this grid, in degrees.
The ParallelSouth property can only be used for the Lambert projections.

Code Sample:

Dim objGrid, objConstants

Set objGrid      = CreateObject ( "Eye4Software.GpsGridParameters" )
Set objConstants = CreateObject ( "Eye4Software.GpsConstants" )

objGrid.Projection      = objConstants.GPS_PROJECTION_LAMBERT2SP

objGrid.FalseNorthing   = 5400088.438000
objGrid.FalseEasting    = 150000.012560

objGrid.ParallelNorth   = 49.833334
objGrid.ParallelSouth   = 51.166667

objGrid.OriginLatitude  = 90.0
objGrid.OriginLongitude = 4.367487


AzimuthAngle property

Type:

Float

In/Out:

In/Out

Optional:

Yes

Description:

The Azimuth angle of initial line, in degrees.
The AzimuthAngle property can only be used for the Krovak and Oblique Mercator projections.

Code Sample:

Dim objGrid, objConstants

Set objGrid      = CreateObject ( "Eye4Software.GpsGridParameters" )
Set objConstants = CreateObject ( "Eye4Software.GpsConstants" )

objGrid.Projection     		= objConstants.GPS_PROJECTION_OBLIQUEMERCATOR

objGrid.FalseNorthing   	= -4354009.816
objGrid.FalseEasting    	=  2546731.496

objGrid.OriginLatitude 	 	=  45.30916666
objGrid.OriginLongitude 	= -86.00000000

objGrid.AzimuthAngle		= 337.25556
objGrid.RectifiedGridAngle	= 337.25556


RectifiedGridAngle property

Type:

Float

In/Out:

In/Out

Optional:

Yes

Description:

The Angle from Rectified to Skew Grid, in degrees.
The ParallelSouth property can only be used for the Oblique Mercator projections.

Code Sample:

Dim objGrid, objConstants

Set objGrid      = CreateObject ( "Eye4Software.GpsGridParameters" )
Set objConstants = CreateObject ( "Eye4Software.GpsConstants" )

objGrid.Projection     		= objConstants.GPS_PROJECTION_OBLIQUEMERCATOR

objGrid.FalseNorthing   	= -4354009.816
objGrid.FalseEasting    	=  2546731.496

objGrid.OriginLatitude 	 	=  45.30916666
objGrid.OriginLongitude 	= -86.00000000

objGrid.AzimuthAngle		= 337.25556
objGrid.RectifiedGridAngle	= 337.25556


Clear Function

Return Value:

Always 0.

Parameters:

None

Optional:

Yes

Description:

Use this function to resets all the values of the GpsGridParameters object to WGS84 datum and geographic latitude/longitude grid.

Code Sample:

Dim objGrid

Set objGrid = CreateObject ( "Eye4Software.GpsGridParameters" )

objGrid.Clear


GetFirstGrid and GetNextGrid Functions

Return Value:

Always 0.

Parameters:

None

Optional:

Yes

Description:

Use these functions to enumerate all build in map grids of the GPS Toolkit. You first have to call GetFirstGrid. While the LastError property is zero, you can call GetNextGrid to load the next available grid. Use the objects properties to retrieve information about the loaded map grid.

Code Sample:

Dim objGrid

Set objGrid = CreateObject ( "Eye4Software.GpsGridParameters" )

objGrid.GetFirstGrid

While ( objGrid.LastError = 0 )
  WScript.Echo "Grid Id   : " & objGrid.Id
  WScript.Echo "Grid Name : " & objGrid.Name
 
  ...
  
  objDatum.GetNextGrid
WEnd


LoadFromId Function

Return Value:

Always 0.

Parameters:

Grid ID

Optional:

Yes

Description:

Use this function to initialize the GpsGridParameters with one of the 3500 built in map grids available in the GPS toolkit. By using this function, you do not have to set all datum and grid parameters manually. For a list of all supported map grids, click here.

Code Sample:

Option Explicit

Dim objProjection
Dim objGridSrc
Dim objGridDst

Set objProjection   = CreateObject ( "Eye4Software.GpsProjection"     )
Set objGridSrc	    = CreateObject ( "Eye4Software.GpsGridParameters" )
Set objGridDst	    = CreateObject ( "Eye4Software.GpsGridParameters" )

WScript.Echo "Eye4Software GPS Toolkit " & objProjection.Version & " - Grid Conversion Demo" 
WScript.Echo

' Set Source Grid ( WGS84, Geographic Latitude and Longitude  )
' 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 or grid, just change the code below (EPSG code)

objGridSrc.LoadFromId (  4326 )

' Set Destination Grid ( Dutch Grid )
' The ID for the Dutch Grid is 28992, see 'http://www.eye4software.com/resources/grids' for a full list of supported grids 
' To convert to another datum or grid, just change the code below (EPSG code)

objGridDst.LoadFromId ( 28992 )

' Set Source coordinates ( WGS84)
objProjection.Latitude		= 52.110000
objProjection.Longitude		=  5.290000

WScript.Echo "Convert from Latitude / Longitude to Dutch Grid (RDNAP)"
WScript.Echo
WScript.Echo "Latitude    = " & objProjection.Latitude
WScript.Echo "Longitude   = " & objProjection.Longitude
WScript.Echo

' Perform the transformation
objProjection.TransformGrid objGridSrc, objGridDst

' Return the result
WScript.Echo "Result: " & objProjection.LastError & " (" & objProjection.LastErrorDescription & ")"
WScript.Echo
If ( objProjection.LastError = 0 ) Then
	WScript.Echo "Northing    = " & objProjection.Northing
	WScript.Echo "Easting     = " & objProjection.Easting
End If

WScript.Echo "Ready."


LoadStatePlane Function

Return Value:

Always 0.

Parameters:

SPCS Id

Optional:

Yes

Description:

Use this function to initialize the GpsGridParameters with one of the built in U.S. State Plane Coordinate Systems available in the GPS toolkit. By using this function, you do not have to set all datum and grid parameters manually. For a list of all supported map grids, click here.

Code Sample:

Option Explicit

Dim objProjection
Dim objGridSrc
Dim objGridDst

Set objProjection   = CreateObject ( "Eye4Software.GpsProjection"     )
Set objGridSrc      = CreateObject ( "Eye4Software.GpsGridParameters" )
Set objGridDst      = CreateObject ( "Eye4Software.GpsGridParameters" )

WScript.Echo "Eye4Software GPS Toolkit " & objProjection.Version & " - StatePlane Conversion Demo" 
WScript.Echo

' Set Source Grid ( NAD83, Geographic Latitude and Longitude  )
' The ID for NAD83 is 4269, see 'http://www.eye4software.com/resources/datums' for a full list of supported datums 
' To convert from another datum or grid, just change the code below (EPSG code)
objGridSrc.LoadFromId ( 4269 )

' Set Destination Grid ( State Plane SPCS83 )
' The ID for the Arizona Central is 0202, see 'http://www.eye4software.com/resources/stateplane' for a full list 
' To convert to another datum or grid, just change the code below (SPC27 or SPC83 code)
objGridDst.LoadStatePlane ( 202 )

' Set Source coordinates ( NAD83 )
objProjection.Latitude		=   31.523864
objProjection.Longitude		= -110.836469

WScript.Echo "Convert from Latitude / Longitude to State Plane (SPCS83) #0202"
WScript.Echo
WScript.Echo "Latitude    = " & objProjection.Latitude
WScript.Echo "Longitude   = " & objProjection.Longitude
WScript.Echo

' Perform the transformation
objProjection.TransformGrid objGridSrc, objGridDst

' Return the result
WScript.Echo "Result: " & objProjection.LastError & " (" & objProjection.LastErrorDescription & ")"
WScript.Echo
If ( objProjection.LastError = 0 ) Then
	WScript.Echo "Northing    = " & objProjection.Northing
	WScript.Echo "Easting     = " & objProjection.Easting
End If



SaveToFile Function

Return Value:

Always 0.

Parameters:

FileName

Optional:

Yes

Description:

Using this function you can save all the values of the GpsGridParameters object (including map datum) to a config file, so you can use the same data again through the LoadFromDisk function.

Code Sample:

Dim objGrid

Set objGrid                 = CreateObject ( "Eye4Software.GpsGridParameters" )
Set objConstants            = CreateObject ( "Eye4Software.GpsConstants" )

objGrid.Projection          = objConstants.GPS_PROJECTION_OBLIQUEMERCATOR

objGrid.FalseNorthing       = -4354009.816
objGrid.FalseEasting        =  2546731.496

objGrid.OriginLatitude      =  45.30916666
objGrid.OriginLongitude     = -86.00000000

objGrid.AzimuthAngle        = 337.25556
objGrid.RectifiedGridAngle  = 337.25556

objGrid.SaveToFile   "C:\Datums\Michigan.ini"


LoadFromFile Function

Return Value:

Always 0.

Parameters:

FileName

Optional:

Yes

Description:

Use this function to read all the values of the GpsGridParameters (including map datum) object from a file.

Code Sample:

Dim objGrid

Set objGrid = CreateObject ( "Eye4Software.GpsGridParameters" )

objDatum.LoadFromDisk "C:\Datums\om.ini"


The 'GpsProjection' object

Overview

The GpsProjection object is used to convert coordinates from one map grid to another, or to perform datum transformations between different map datums.
To perform coordinate transformations between different grids, you also need to declare and create two GpsDatumParameters and two GpsGridParameter objects, one for the source grid, and one for the destination grid. If you only want to do a datum transformation on a single latitude / longitude position, only two GpsDatumParameter objects are needed. To perform grid transformations, use the TransformGrid function, for datum transformations use the TransformDatum function.

Object Properties

Property Name Type Description
Version String Can be used to retrieve the version of the control used
RegistrationCode String To activate your product, use this property to set the registrationcode received
Registered String Displays the number of days left for evaluation,
or just registered when the software has been purchased
LastError Number The result of the last operation (numeric error code)
LastErrorDescription String The result of the last operation (textual description)
LogFile String File used to log all the tranformations
Latitude Float Source and/or destination latitude coordinate
Longitude Float Source and/or destination longitude coordinate
Altitude Float Source and/or destination altitude
Easting Float Source and/or destination easting (or X) coordinate
Northing Float Source and/or destination northing (or Y) coordinate
Zone Number UTM Zone number detected or to use for UTM functions


Object Functions

Function Name Description
Clear Clears all property values
TransformDatum Perform a transformation between two different map datums
TransformGrid Perform a transformation between two different map grids
ToUtm Convert a coordinate from latitude/longitude to UTM
FromUtm Convert an UTM coordinate to latitude/longitude


Version property

Type:

String

In/Out:

Out

Optional:

Yes

Description:

The version property can be used to print the version number of the GPS toolkit version currently used.

Code Sample:

Set objPrj = CreateObject ( "Eye4Software.GpsProjection" )

WScript.Echo objPrj.Version


RegistrationCode property

Type:

String

In/Out:

In

Optional:

Yes

Description:

Use this property to activate the software. Once you purchased the software, you will receive a license code. Assign this code to this property to be able to use the software after the evaluation has been expired.

Code Sample:

Set objPrj = CreateObject ( "Eye4Software.GpsProjection" )

objPrj.RegistrationCode = "XXXXXXXXXXXXXXXXXXXXXXXXXXX"


Registered property

Type:

String

In/Out:

Out

Optional:

Yes

Description:

This string returns license information, for instance if the software has been registered or how many days there are left for evaluation

Code Sample:

Set objPrj = CreateObject ( "Eye4Software.GpsProjection" )

If ( objPrj.Registered = True ) Then
 Wscript.Echo "Registration OK"
Else
 WScript.Echo "Invalid license key, or trial has been expired"
End If


LastError property

Type:

Number

In/Out:

Out

Optional:

Yes

Description:

When one of the functions has been executed, this property returns the result code of this function. To get the description of this error, use the "LastErrorDescription" property instead.

Code Sample:

Set objProj     = CreateObject ( "Eye4Software.GpsProjection" )
Set objDatumSrc = CreateObject ( "Eye4Software.GpsDatumParameters" )
Set objDatumDst = CreateObject ( "Eye4Software.GpsDatumParameters" )

...

objProj.TransformDatum objDatumSrc, objDatumDst

WScript.Echo "Transform datum, result = " & objProj.LastError & " ( " & objProj.LastErrorDescription & " )"
...


LastErrorDescription property

Type:

Number

In/Out:

Out

Optional:

Yes

Description:

When one of the functions has been executed, this property returns the result code of this function. The result is displayed in textual format. To get the number of this error, use the "LastError" property instead.

Code Sample:

Set objProj     = CreateObject ( "Eye4Software.GpsProjection" )
Set objDatumSrc = CreateObject ( "Eye4Software.GpsDatumParameters" )
Set objDatumDst = CreateObject ( "Eye4Software.GpsDatumParameters" )

...

objProj.TransformDatum objDatumSrc, objDatumDst

WScript.Echo "Transform datum, result = " & objProj.LastError & " ( " & objProj.LastErrorDescription & " )"
...


LogFile property

Type:

String

In/Out:

In/Out

Optional:

Yes

Description:

Use this property to specify the file where all operations should be logged to perform troubleshooting.
Code Sample:

Set objProj     = CreateObject ( "Eye4Software.GpsProjection" )
Set objDatumSrc = CreateObject ( "Eye4Software.GpsDatumParameters" )
Set objDatumDst = CreateObject ( "Eye4Software.GpsDatumParameters" )

...
objProj.LogFile = "C:\LogFile.txt"

objProj.TransformDatum objDatumSrc, objDatumDst

WScript.Echo "Transform datum, result = " & objProj.LastError & " ( " & objProj.LastErrorDescription & " )"
...


Latitude

Type:

Float

In/Out:

In/Out

Optional:

Yes

Description:

The source and / or destination latitude used when performing transformation. Depending on the projectiontype that is used, you have to set either the Latitude or Northing property. When performing a datum translation, only the Latitude and Longitude properties can be used.

Code Sample:

Set objProj     = CreateObject ( "Eye4Software.GpsProjection" )
Set objDatumSrc = CreateObject ( "Eye4Software.GpsDatumParameters" )
Set objDatumDst = CreateObject ( "Eye4Software.GpsDatumParameters" )

...

objProj.Latitude  = 51.9
objproj.Longitude = 4.4

objProj.TransformDatum objDatumSrc, objDatumDst

WScript.Echo "Latitude  after datum transformation: " & objProj.Latitude
WScript.Echo "Longitude after datum transformation: " & objProj.Longitude


Longitude property

Type:

Float

In/Out:

In/Out

Optional:

Yes

Description:

The source and / or destination longitude used when performing transformation. Depending on the projectiontype that is used, you have to set either the Longitude or Easting property. When performing a datum translation, only the Latitude and Longitude properties can be used.

Code Sample:

Set objProj     = CreateObject ( "Eye4Software.GpsProjection" )
Set objDatumSrc = CreateObject ( "Eye4Software.GpsDatumParameters" )
Set objDatumDst = CreateObject ( "Eye4Software.GpsDatumParameters" )
Set objGridSrc  = CreateObject ( "Eye4Software.GpsGridParameters" )
Set objGridDst  = CreateObject ( "Eye4Software.GpsGridParameters" )

...

objProj.Northing  = 200000
objproj.Easting   = 400000

objProj.TransformGrid objDatumSrc, objDatumDst

WScript.Echo "Latitude  after datum transformation: " & objProj.Latitude
WScript.Echo "Longitude after datum transformation: " & objProj.Longitude


Altitude property

Type:

Float

In/Out:

In/Out

Optional:

Yes

Description:

The source and destination altitude used when performing 3D datum / grid transformations. When performing a datum transformation, the datum transformation is also applied to this altitude.
When a map grid is used, the in and output is in the unit specified in the grid, otherwise meters are used.

Code Sample:

Set objProjection = CreateObject ( "Eye4Software.GpsProjection" )
Set objDatumSrc   = CreateObject ( "Eye4Software.GpsDatumParameters" )
Set objDatumDst   = CreateObject ( "Eye4Software.GpsDatumParameters" )

objProjection.Latitude		=    33.59638
objProjection.Longitude		=  -112.15133
objProjection.Altitude		=     0.00000

objDatumSrc.LoadFromId ( 4326 ) ' From WGS84
objDatumDst.LoadFromId ( 4267 ) ' To   NAD27

objProjection.TransformDatum objDatumSrc, objDatumDst

WScript.Echo "Latitude  after datum transformation: " & objProjection.Latitude
WScript.Echo "Longitude after datum transformation: " & objProjection.Longitude
WScript.Echo "Altitude  after datum transformation: " & objProjection.Altitude


Northing property

Type:

Float

In/Out:

In/Out

Optional:

Yes

Description:

The source and / or destination northing (or Y) used when performing transformation. Depending on the projectiontype that is used, you have to set either the Latitude or Northing property. When performing a datum translation, only the Latitude and Longitude properties can be used.

Code Sample:

Set objProj     = CreateObject ( "Eye4Software.GpsProjection" )
Set objDatumSrc = CreateObject ( "Eye4Software.GpsDatumParameters" )
Set objDatumDst = CreateObject ( "Eye4Software.GpsDatumParameters" )
Set objGridSrc  = CreateObject ( "Eye4Software.GpsGridParameters" )
Set objGridDst  = CreateObject ( "Eye4Software.GpsGridParameters" )

...

objProj.Northing  = 200000
objproj.Easting   = 400000

objProj.TransformGrid objDatumSrc, objDatumDst

WScript.Echo "Latitude  after datum transformation: " & objProc.Latitude
WScript.Echo "Longitude after datum transformation: " & objProc.Longitude


Easting property

Type:

Float

In/Out:

In/Out

Optional:

Yes

Description:

The source and / or destination easting (or X) used when performing transformation. Depending on the projectiontype that is used, you have to set either the Longitude or Easting property. When performing a datum translation, only the Latitude and Longitude properties can be used.

Code Sample:

Set objProj     = CreateObject ( "Eye4Software.GpsProjection" )
Set objDatumSrc = CreateObject ( "Eye4Software.GpsDatumParameters" )
Set objDatumDst = CreateObject ( "Eye4Software.GpsDatumParameters" )
Set objGridSrc  = CreateObject ( "Eye4Software.GpsGridParameters" )
Set objGridDst  = CreateObject ( "Eye4Software.GpsGridParameters" )

...

objProj.Northing  = 200000
objproj.Easting   = 400000

objProj.TransformGrid objDatumSrc, objDatumDst

WScript.Echo "Northing after grid transformation: " & objProc.Northing
WScript.Echo "Easting  after grid transformation: " & objProc.Easting


Zone property

Type:

Number

In/Out:

In/Out

Optional:

Yes

Description:

This property is used by both the FromUTM and ToUTM functions. With the ToUTM function you can set it to override the zone autodetection, when it is set to zero before calling ToUTM, it contains the detected zone when this function has been completed successfully. The FromUTM function does not support autodetection of the zone, because it is only possible when the latitude and longitude coordinates are known. In this case it is required to set this parameter.
Code Sample:

Option Explicit

Dim objDatum, objProjection

Set objDatum        = CreateObject ( "Eye4Software.GpsDatumParameters" )
Set objProjection   = CreateObject ( "Eye4Software.GpsProjection" )

' Set Datum NAD27 (EPSG ID 4267)
objDatum.LoadFromId ( 4267 )

' Set Source coordinates
objProjection.Latitude      = 51.900000
objProjection.Longitude     =  4.400000
objProjection.Zone          =  0 'Use Autodetect

' Perform the transformation
objProjection.ToUtm objDatum

' Return the result
WScript.Echo "Convert from Latitude / Longitude to UTM NAD 27"
WScript.Echo
WScript.Echo "Result: " & objProjection.LastError & " (" & objProjection.LastErrorDescription & ")"
WScript.Echo
If ( objProjection.LastError = 0 ) Then
    WScript.Echo "Latitude    = " & objProjection.Latitude
    WScript.Echo "Longitude   = " & objProjection.Longitude
    WScript.Echo
    WScript.Echo "Northing    = " & objProjection.Northing
    WScript.Echo "Easting     = " & objProjection.Easting
    WScript.Echo "Zone        = " & objProjection.Zone
End If

WScript.Echo "Ready."



Clear Function

Return Value:

Always 0.

Parameters:

None

Optional:

Yes

Description:

Use this function to clear all the values of the GpsProjection object.

Code Sample:

Set objProj     = CreateObject ( "Eye4Software.GpsProjection" )

'Clear Latitude, Longitude, Easting and Northing properties
objProj.Clear


TransformDatum Function

Return Value:

Always 0.

Parameters:

a GpsDatumParameters object containing the source datum parameters.
a GpsDatumParameters object containing the destination datum parameters.

Optional:

Yes

Description:

Use this function to perform a geodetic datum transformation on the specified Latitude and Longitude.
The source and destination datum are specified by using GpsDatumParameters objects. A list of geodetic datums around the world can be found here.

Code Sample:

Option Explicit

Dim objDatumSrc, objDatumDst, objProjection

Set objProjection   = CreateObject ( "Eye4Software.GpsProjection" )
Set objDatumSrc     = CreateObject ( "Eye4Software.GpsDatumParameters" )
Set objDatumDst     = CreateObject ( "Eye4Software.GpsDatumParameters" )

' Set Source Datum: WGS84
onjDatumSrc.Clear

objDatumSrc.Axis            = 6378137.000
objDatumSrc.Flattening      = 298.257223563

' Set Destination Datum: OSGB36
objDatumDst.Axis            = 6377340.189
objDatumDst.Flattening      =  299.32496546352854
objDatumDst.TranslationX    =  446.448
objDatumDst.TranslationY    = -125.157
objDatumDst.TranslationZ    =  542.060
objDatumDst.RotationX       =    0.150
objDatumDst.RotationY       =    0.247
objDatumDst.RotationZ       =    0.842
objDatumDst.ScaleFactor     = -20.4894

' Set Source coordinates
objProjection.Latitude      = 51.900000
objProjection.Longitude     =  4.400000

WScript.Echo "Convert from WGS84 to OSGB36"
WScript.Echo
WScript.Echo "Latitude    = " & objProjection.Latitude
WScript.Echo "Longitude   = " & objProjection.Longitude
WScript.Echo

' Perform the transformation
objProjection.TransformDatum objDatumSrc, objDatumDst

' Return the result
WScript.Echo "Result: " & objProjection.LastError & " (" & objProjection.LastErrorDescription & ")"
WScript.Echo
If ( objProjection.LastError = 0 ) Then
    WScript.Echo "Latitude    = " & objProjection.Latitude
    WScript.Echo "Longitude   = " & objProjection.Longitude
End If

WScript.Echo "Ready."


TransformGrid Function

Return Value:

Always 0.

Parameters:

a GpsGridParameters object containing the source map grid parameters.
a GpsGridParameters object containing the destination map grid parameters.

Optional:

Yes

Description:

Use this function to perform a map grid conversion. You can convert coordinates from Latitude / Longitude to a map grid, backwards and from one grid to another.
Various map projections can be used like: Transverse Mercator, Oblique Mercator, Mercator, Lambert Conformal Conic, Oblique Stereographic, Polar Stereographic, Albers Equal Area Conic and others.
The source and destination grid are specified by using GpsGridParameters objects. A list of map grids around the world can be found here.

Code Sample (Lambert Conformal Conic Projection):

Option Explicit

Dim objDatumSrc, objDatumDst, objGridSrc, objGridDst, objProjection, objConstants

Set objDatumSrc     = CreateObject ( "Eye4Software.GpsDatumParameters" )
Set objDatumDst     = CreateObject ( "Eye4Software.GpsDatumParameters" )
Set objGridSrc      = CreateObject ( "Eye4Software.GpsGridParameters" )
Set objGridDst      = CreateObject ( "Eye4Software.GpsGridParameters" )
Set objProjection   = CreateObject ( "Eye4Software.GpsProjection" )
Set objConstants    = CreateObject ( "Eye4Software.GpsConstants" )

' Set Source Datum: WGS84
objDatumSrc.Axis            = 6378137.000
objDatumSrc.Flattening      = 298.257223563

' Set Source GridL: Latitude/Longitude
objGridSrc.Projection       = objConstants.GPS_PROJECTION_NONE
objGridSrc.Datum            = objDatumSrc

' Set Destination Datum: Belgium 1972
objDatumDst.Axis            = 6378388.000
objDatumDst.Flattening      =  297.000
objDatumDst.TranslationX    =  -99.059
objDatumDst.TranslationY    =   53.322
objDatumDst.TranslationZ    = -112.486
objDatumDst.RotationX       =    0.419
objDatumDst.RotationY       =   -0.830
objDatumDst.RotationZ       =    1.885
objDatumDst.ScaleFactor     =   -1.000

' Set destination grid: Belgium Lambert 72
objGridDst.Projection       = objConstants.GPS_PROJECTION_LAMBERT2SP
objGridDst.Datum            = objDatumDst
objGridDst.FalseNorthing    = 5400088.438000
objGridDst.FalseEasting     = 150000.012560
objGridDst.OriginLatitude   = 90.0
objGridDst.OriginLongitude  = 4.367487
objGridDst.ParallelNorth    = 49.833334
objGridDst.ParallelSouth    = 51.166667
objGridDst.ScaleFactor      = 0.0000

' Set Source coordinates
objProjection.Latitude      = 51.900000
objProjection.Longitude     =  4.400000

' Perform the transformation
objProjection.TransformGrid objGridSrc, objGridDst

' Return the result
WScript.Echo "Convert from Latitude / Longitude to Lambert-72 using Lambert projection"
WScript.Echo
WScript.Echo "Result: " & objProjection.LastError & " (" & objProjection.LastErrorDescription & ")"
WScript.Echo
If ( objProjection.LastError = 0 ) Then
    WScript.Echo "Latitude    = " & objProjection.Latitude
    WScript.Echo "Longitude   = " & objProjection.Longitude
    WScript.Echo
    WScript.Echo "Northing    = " & objProjection.Northing
    WScript.Echo "Easting     = " & objProjection.Easting
End If

WScript.Echo "Ready."


Code Sample (Transverse Mercator):

Option Explicit

Dim objDatumSrc, objDatumDst, objGridSrc, objGridDst, objProjection, objConstants

Set objDatumSrc     = CreateObject ( "Eye4Software.GpsDatumParameters" )
Set objDatumDst     = CreateObject ( "Eye4Software.GpsDatumParameters" )
Set objGridSrc      = CreateObject ( "Eye4Software.GpsGridParameters" )
Set objGridDst      = CreateObject ( "Eye4Software.GpsGridParameters" )
Set objProjection   = CreateObject ( "Eye4Software.GpsProjection" )
Set objConstants    = CreateObject ( "Eye4Software.GpsConstants" )

' Set Source Datum: WGS84
objDatumSrc.Axis            = 6378137.000
objDatumSrc.Flattening      = 298.257223563

' Set Source GridL: Latitude/Longitude
objGridSrc.Projection       = objConstants.GPS_PROJECTION_NONE
objGridSrc.Datum            = objDatumSrc

' Set Destination Datum: WGS84
objDatumDst.Axis            = 6378137.000
objDatumDst.Flattening      = 298.257223563

' Set destination grid: RDNAP
objGridDst.Projection       = objConstants.GPS_PROJECTION_TRANSVERSEMERCATOR
objGridDst.Datum            = objDatumDst
objGridDst.FalseNorthing    = 0
objGridDst.FalseEasting     = 500000
objGridDst.OriginLatitude   = 0
objGridDst.OriginLongitude  = 3
objGridDst.ScaleFactor      = 0.9996

' Set Source coordinates
objProjection.Latitude      = 51.900000
objProjection.Longitude     =  4.400000

' Perform the transformation
objProjection.TransformGrid objGridSrc, objGridDst

' Return the result
WScript.Echo "Convert from Latitude / Longitude to UTM Zone 31 using transverse mercator projection"
WScript.Echo
WScript.Echo "Result: " & objProjection.LastError & " (" & objProjection.LastErrorDescription & ")"
WScript.Echo
If ( objProjection.LastError = 0 ) Then
    WScript.Echo "Latitude    = " & objProjection.Latitude
    WScript.Echo "Longitude   = " & objProjection.Longitude
    WScript.Echo
    WScript.Echo "Northing    = " & objProjection.Northing
    WScript.Echo "Easting     = " & objProjection.Easting
End If

WScript.Echo "Ready."


ToUtm Function

Return Value:

Always 0.

Parameters:

a GpsDatumParameters object containing the map datum used for the UTM grid.

Optional:

Yes

Description:

In case you only have to perform UTM conversions, you can use this function. From the given latitude and longitude, it calculates the correct UTM zone and converts the coordinate to UTM. The calculated zone is returned. You can force the UTM zone to be used, by passing the zone as a parameter. When it is set to default (0) the zone is calculated.
Code Sample (UTM NAD27):

Option Explicit

Dim objDatum, objProjection, objConstants

Set objDatum        = CreateObject ( "Eye4Software.GpsDatumParameters" )
Set objProjection   = CreateObject ( "Eye4Software.GpsProjection" )
Set objConstants    = CreateObject ( "Eye4Software.GpsConstants" )

' Set Datum NAD27 (EPSG ID 4267)
objDatum.LoadFromId ( 4267 )

' Set Source coordinates
objProjection.Latitude      = 51.900000
objProjection.Longitude     =  4.400000

' Perform the transformation
objProjection.ToUtm objDatum

' Return the result
WScript.Echo "Convert from Latitude / Longitude to UTM NAD 27"
WScript.Echo
WScript.Echo "Result: " & objProjection.LastError & " (" & objProjection.LastErrorDescription & ")"
WScript.Echo
If ( objProjection.LastError = 0 ) Then
    WScript.Echo "Latitude    = " & objProjection.Latitude
    WScript.Echo "Longitude   = " & objProjection.Longitude
    WScript.Echo
    WScript.Echo "Northing    = " & objProjection.Northing
    WScript.Echo "Easting     = " & objProjection.Easting
    WScript.Echo "Zone        = " & objProjection.Zone
End If

WScript.Echo "Ready."


FromUtm Function

Return Value:

Always 0.

Parameters:

a GpsDatumParameters object containing the map datum used for the UTM grid.

Optional:

Yes

Description:

In case you only have to perform UTM to latitude / longitude conversions, you can use this function. From the given Northing and Easting, it calculates the correct hemisphere and converts the coordinate to latitude / longitude. You must force the UTM zone to be used, by setting the zone as a parameter.
Code Sample (UTM NAD27):

Option Explicit

Dim objDatum, objProjection

Set objDatum        = CreateObject ( "Eye4Software.GpsDatumParameters" )
Set objProjection   = CreateObject ( "Eye4Software.GpsProjection" )

' Set Datum NAD27 (EPSG ID 4267)
objDatum.LoadFromId ( 4267 )

' Set Source coordinates
objProjection.Northing      = 5750842.171
objProjection.Easting       =  596322.494
objProjection.Zone          =          31 ' UTM Zone 31N

' Perform the transformation
objProjection.FromUtm objDatum

' Return the result
WScript.Echo "Convert from UTM NAD27 to Latitude / Longitude"
WScript.Echo
WScript.Echo "Result: " & objProjection.LastError & " (" & objProjection.LastErrorDescription & ")"
WScript.Echo
If ( objProjection.LastError = 0 ) Then
    WScript.Echo "Northing    = " & objProjection.Northing
    WScript.Echo "Easting     = " & objProjection.Easting
    WScript.Echo "Zone        = " & objProjection.Zone
    WScript.Echo "Latitude    = " & objProjection.Latitude
    WScript.Echo "Longitude   = " & objProjection.Longitude
    WScript.Echo
    
End If

WScript.Echo "Ready."


The 'GpsUtilities' object

Overview

The GpsUtilities object is a collection of miscellaneous functions, which can be used in your GPS applications. It contains functions for unit conversion, distance calculations, latitude/longitude string encoding/decoding and more.

Object Properties

Property Name Type Description
Version String Can be used to retrieve the version of the control used
RegistrationCode String To activate your product, use this property to set the registrationcode received
Registered String Displays the number of days left for evaluation,
or just registered when the software has been purchased
LastError Number The result of the last operation (numeric error code)
LastErrorDescription String The result of the last operation (textual description)


Object Functions

Function Name Description
Clear Clears all property values
ConvertUnits Perform a conversion between two different units
CalculateDistance Calculate distance between two coordinates
CalculateAzimuth Calculate azimuth between two coordinates
FormatLatitudeString Convert decimal latitude to formatted string
FormatLongitudeString Convert decimal longitude to formatted string
ParseLatitudeString Convert formatted latitude string to decimal value
ParseLongitudeString Convert formatted longitude string to decimal value


Version property

Type:

String

In/Out:

Out

Optional:

Yes

Description:

The version property can be used to print the version number of the GPS toolkit version currently used.

Code Sample:

Set objUtilities = CreateObject ( "Eye4Software.GpsUtilities" )

WScript.Echo objUtilities.Version


RegistrationCode property

Type:

String

In/Out:

In

Optional:

Yes

Description:

Use this property to activate the software. Once you purchased the software, you will receive a license code. Assign this code to this property to be able to use the software after the evaluation has been expired.

Code Sample:

Set objUtilities = CreateObject ( "Eye4Software.GpsUtilities" )

objUtilities.RegistrationCode = "XXXXXXXXXXXXXXXXXXXXXXXXXXX"


Registered property

Type:

String

In/Out:

Out

Optional:

Yes

Description:

This string returns license information, for instance if the software has been registered or how many days there are left for evaluation

Code Sample:

Set objUtilities = CreateObject ( "Eye4Software.GpsUtilities" )

If ( objUtilities.Registered = True ) Then
 Wscript.Echo "Registration OK"
Else
 WScript.Echo "Invalid license key, or trial has been expired"
End If


LastError property

Type:

Number

In/Out:

Out

Optional:

Yes

Description:

When one of the functions has been executed, this property returns the result code of this function. To get the description of this error, use the "LastErrorDescription" property instead.

Code Sample:

Set objConstants = CreateObject ( "Eye4Software.GpsConstants" )
Set objUtilities = CreateObject ( "Eye4Software.GpsUtilities" )

fNorthing = objUtilities.ConvertUnits ( objConstants.GPS_PROJECTION_UNITS_M, objConstants.GPS_PROJECTION_UNITS_FTUS, fNorthing )

If ( objUtilities.LastError = 0 ) Then
...
End If


LastErrorDescription property

Type:

Number

In/Out:

Out

Optional:

Yes

Description:

When one of the functions has been executed, this property returns the result code of this function. The result is displayed in textual format. To get the number of this error, use the "LastError" property instead.

Code Sample:

Set objConstants = CreateObject ( "Eye4Software.GpsConstants" )
Set objUtilities = CreateObject ( "Eye4Software.GpsUtilities" )

fNorthing = objUtilities.ConvertUnits ( objConstants.GPS_PROJECTION_UNITS_M, objConstants.GPS_PROJECTION_UNITS_FTUS, fNorthing )

WScript.Echo "Result = " & objUtilities.LastErrorDescription


Clear Function

Return Value:

Always 0.

Parameters:

None

Optional:

Yes

Description:

Use this function to clear all the values of the GpsUtilities object.

Code Sample:

Set objUtils    = CreateObject ( "Eye4Software.GpsUtilities" )

'Clear all properties
objUtils.Clear


ConvertUnits Function

Return Value:

Output Value

Parameters:

Input Units
Output Units
Input Value

Optional:

Yes

Description:

Use this function to convert values from one unit to another.
Pass the input value, input and output units to this function to get the converted value returned.
You can specify the input and output units using one of the following constants

Code Sample:

Set objUtils    = CreateObject ( "Eye4Software.GpsUtilities" )

WScript.Echo "Northing    = " & objUtils.ConvertUnits ( objConstants.GPS_PROJECTION_UNITS_M, objConstants.GPS_PROJECTION_UNITS_FTUS ,objProjection.Northing )
WScript.Echo "Easting     = " & objUtils.ConvertUnits ( objConstants.GPS_PROJECTION_UNITS_M, objConstants.GPS_PROJECTION_UNITS_FTUS ,objProjection.Easting  )


CalculateDistance Function

Return Value:

Distance

Parameters:

Source Latitude
Source Longitude
Destination Latitude
Destination Longitude

Optional:

Yes

Description:

To calculate the distance between two (latitude/longitude) coordinates, use this function.
The function uses the Vincenty's formula which is much more accurate ( < 0.1 m ) then the great circle formula.
The output is always in meters, you can use the ConvertUnits function to convert the value.

Code Sample:

Set objUtils    = CreateObject ( "Eye4Software.GpsUtilities" )

WScript.Echo "Distance = " & objUtils.CalculateDistance ( 51.9, 4.24, 51.89, 4.93 )


CalculateAzimuth Function

Return Value:

Distance

Parameters:

Source Latitude
Source Longitude
Destination Latitude
Destination Longitude

Optional:

Yes

Description:

To calculate the azimuth (bearing) between two (latitude/longitude) coordinates, use this function.
The function uses the great circle formula, the output is in degrees
To calculate the reverse azimuth, just swap the source and destination coordinates

Code Sample:

Set objUtils    = CreateObject ( "Eye4Software.GpsUtilities" )

WScript.Echo "Azimuth       = " & objUtils.CalculateDistance ( 51.9, 4.24, 51.89, 4.93 )
WScript.Echo "Azimuth (Rev) = " & objUtils.CalculateDistance ( 51.89, 4.93, 51.9, 4.24 )


FormatLatitudeString, FormatLongitudeString Functions

Return Value:

The formatted latitude or longitude string

Parameters:

Format
Latitude or Longitude

Optional:

Yes

Description:

Use the function to convert a decimal latitude or longitude value to a formatted string. Pass the latitude or longitude value and a Latitude and Longitude format constant to this function to return the string. The following formats are supported:

  • 54.123428 N (Decimal Degrees)
  • 54 32.521' N (Decimal Degrees, Minutes)
  • 54 12' 32.12" N (Decimal Degrees, Minutes and Seconds)

Code Sample:

Set objUtilities  = CreateObject ( "Eye4Software.GpsUtilities" )
Set objConstants  = CreateObject ( "Eye4Software.GpsConstants" )

WScript.Echo objUtilities.FormatLatitudeString  ( objConstants.GPS_LATLONFORMAT_DMS, 51.1234 )
WScript.Echo objUtilities.FormatLongitudeString ( objConstants.GPS_LATLONFORMAT_DMS,  4.5678 )


ParseLatitude, ParseLongitude Functions

Return Value:

Latitude or Longitude

Parameters:

Format
Formatted String

Optional:

Yes

Description:

Use the function to convert a formatted latitude or longitude string to a decimal value. Pass the string value and a Latitude and Longitude format constant to this function to return the value. The following formats are supported:

  • 54.123428 N (Decimal Degrees)
  • 54 32.521' N (Decimal Degrees, Minutes)
  • 54 12' 32.12" N (Decimal Degrees, Minutes and Seconds)

Code Sample:

Set objUtilities	= CreateObject ( "Eye4Software.GpsUtilities" )
Set objConstants  = CreateObject ( "Eye4Software.GpsConstants" )

strLatitude  = " 51 54 24.24 N"
strLongitude = "004 34 28.58 E"

dblLatitude  = objUtilities.ParseLatitudeString   ( objConstants.GPS_LATLONFORMAT_DMS, strLatitude  )
dblLongitude = objUtilities.ParseLongitudeString  ( objConstants.GPS_LATLONFORMAT_DMS, strLongitude )

WScript.Echo "Parsed coordinates: " & dblLatitude & " / " & dblLongitude