|
Download the Eye4Software GPS Toolkit fully functional 30 day trial version for free |
|
Browse through the Eye4Software GPS Toolkit manual |
The State Plane Coordinate System (SPS or SPCS) is a set of 124 coordinate systems designed for specific regions of the United States. There are two variations of the system, one uses NAD27 as map datum, also called SPCS27, the second one uses NAD83 as map datum, this system is known as SPCS83. SPCS27 grids mostly use U.S. Survey Foot as output units, while the SPCS83 grids use Meters. Each state contains one or more state plane zones, the boundaries of which usually follow county lines. There are 110 zones in the continental US, with 10 more in Alaska, 5 in Hawaii, and one for Puerto Rico and US Virgin Islands.
The system is widely used for geographic data by state and local governments. Its popularity is due to at least two factors. First, it uses a simple Cartesian coordinate system to specify locations rather than a more complex spherical coordinate system (the geographic coordinate system of latitude and longitude). By thus ignoring the curvature of the Earth, "plane surveying" methods can be used, speeding up and simplifying calculations. Second, the system is highly accurate within each zone (error less than 1:10,000). Outside a specific state plane zone accuracy rapidly declines, thus the system is not useful for regional or national mapping.
The Eye4Software GPS toolkit allows software developers to add GPS functionality to their programs or scripts, like reading position information from a GPS, calculating distance and azimuth between two coordinates, map datum and map grid conversion. Using the GPS toolkit, it is not required to have any knowledge on serial communications, GPS protocols like RS-232 and NMEA0183, math and geodesy.
The product can be used in many programming environments, such as Visual Basic, Visual C++, Visual Studio.Net, Borland C++ Builder, Borland Delphi and VBA, but also web oriented applications such as ASP, ASP.NET and PHP, and all other programming environments that support ActiveX.
First you must have Borland Delphi and the Eye4Software GPS Component installed on your computer. We will use Borland Delphi 7.0 in this document, but other versions from 6.0 and up can be used also. You can download the Eye4Software GPS Component here.
For this demo, a console application is used. To create a simple console application project in Delphi, follow the next steps: Select the "Other..." option from the "File" => "New" Menu and select the "Console Application" option, and click "OK".
To use ActiveX controls in a Delphi Console Application project, you first have to specify some units to add ActiveX support. Modify the "uses" block at the top of the code like this:
uses SysUtils, OleServer, ComObj, ActiveX;
Declare the objects like this:
var objGpsProjection : Variant; objGpsGridSrc : Variant; objGpsGridDst : Variant;
Before the program is able to load OLE objects, we have to initialize OLE/COM, otherwise an exception is thrown when we try to execute the program:
OleInitialize ( nill );
It is now time to create the objects:
objGpsProjection := CreateOleObject ( 'Eye4Software.GpsProjection' ); objGpsGridSrc := CreateOleObject ( 'Eye4Software.GpsGridParameters' ); objGpsGridDst := CreateOleObject ( 'Eye4Software.GpsGridParameters' );
The following samples show how to perform a coordinate conversion from (GPS) latitude / longitude coordinates to U.S. State Plane coordinates using the GPS Toolkit. In this example a position is transformed from NAD23 to SPCS27 California Zone III. For a list of other U.S. State Plane zones, please refer to our U.S. State Plane information page.
program ConvStatePlane;
{$APPTYPE CONSOLE}
uses
SysUtils, OleServer, ComObj, ActiveX;
{Declare the GPS Toolkit objects}
var
objGpsProjection : Variant;
objGpsGridSrc : Variant;
objGpsGridDst : Variant;
begin
{ Initialize OLE }
OleInitialize ( nil );
{ Create Objects }
objGpsProjection := CreateOleObject ( 'Eye4Software.GpsProjection' );
objGpsGridSrc := CreateOleObject ( 'Eye4Software.GpsGridParameters' );
objGpsGridDst := CreateOleObject ( 'Eye4Software.GpsGridParameters' );
{ Set Source Datum }
objGpsGridSrc.LoadFromId ( 4267 );
{ Set Destination Grid }
objGpsGridDst.LoadStatePlane ( 10403 );
{ Set Source Latitude and Longitude }
objGpsProjection.Latitude := 37.793250;
objGpsProjection.Longitude := -122.554783;
{ Display the result }
WriteLn ( 'Latitude (NAD27) : ' + FloatToStr ( objGpsProjection.Latitude ) );
WriteLn ( 'Longitude (NAD27) : ' + FloatToStr ( objGpsProjection.Longitude ) );
{ Transform }
objGpsProjection.TransformGrid ( objGpsGridSrc, objGpsGridDst );
WriteLn ( 'Northing (SPCS27) : ' + FloatToStr ( objGpsProjection.Northing ) );
WriteLn ( 'Easting (SPCS27) : ' + FloatToStr ( objGpsProjection.Easting ) );
end.