Detailed Description of the current Version
User Manual with all Function Descriptions
User Manual searching for expressions
List of Coordinate and Reference Systems
Download of the supported NTv2 / HARN grid files
Programming example
Group Prices GeoDLL
Download
Place order
GeoDLL - Function Groups
Function group "Coordinate Transformations"
Additional function group "NTv2 Transformations"
Function group "NTv2 Tools"
Function group "User Definitions"
Function group "Parameter Determination"
Function group "Distance Calculations"
Function group "Notation Calculations"
Function group "Map Calculations"
Function group "Elevation Calculations"
Function group "Transformation Parameter"
Function group "Time Zone Calculations"
Geodetic functions without group assignment
Continental Drift
At present 2 to 7 cm per year
/******************************************************************************/
/* */
/* Template of a C / C++ program as Visual Studio Project */
/* for some function calls of the 32/64 bit Dynamic Link Library GeoDLL. */
/* The template can be extended for other GeoDLL function calls if necessary. */
/* */
/*----------------------------------------------------------------------------*/
/* */
/* Required external files: */
/* 1. GeoDLL??.h: Include the header file in the Visual Studio project */
/* 2. GeoDLL??.lib: Include the library file in the Visual Studio project */
/* 3. GeoDLL??.dll: The DLL must be present in the EXE start directory */
/* 4. GeoDLLbn.bin: The Binary must be present in the EXE start directory */
/* (?? = 32 for 32 bit builds, ?? = 64 for 64 bit builds) */
/* */
/* Download of the complete Visual Studio project GeoTestCpp: */
/* https://www.killetsoft.de/zip/geotestcpp.zip */
/* */
/* Online user manual with all function declarations: */
/* https://www.killetsoft.de/h_geodll_e/handbuch_e.htm in English langeuage */
/* https://www.killetsoft.de/h_geodll_e/handbuch_d.htm in German langeuage */
/* */
/* In the GeoDLL download included help files with all function declarations: */
/* GeoDLL_e.chm in English langeuage */
/* GeoDLL_e.chm in German langeuage */
/* */
/* Author of this source and GeoDLL: */
/* Dipl.-Ing. Fred Killet */
/* Killet GeoSoftware Ing.-GbR */
/* httsp://www.killetsoft.de */
/* */
/******************************************************************************/
//==============================================================================
// Program for testing some functions of the Dynamic Link Library GeoDLL,
// developed by Killet GeoSoftware Ing.-GbR.
// The program is written in the programming language C++ and devoloped under
// Microsoft Visual Studio 2010. It shell exemplary explain the creation of own
// applications, which use geodetic functions from GeoDLL.
// For linking the GeoDLL functions to your own application, the supplied files
// GeoDLL??.h and GeoDLL??.lib are used in the project. The files GeoDLL??.dll
// and GeoDLLbn.bin must be available in your applications start directory.
//==============================================================================
//------------------------------------------------------------------------------
// Includes Plattform SDK
//------------------------------------------------------------------------------
#include
#include
#include
#include
//------------------------------------------------------------------------------
// Project Spezific Includes
//------------------------------------------------------------------------------
// Change to "geodll64.h" if you build a 64 bit program
#include "geodll32.h"
//------------------------------------------------------------------------------
// Modul internal Prototypes
//------------------------------------------------------------------------------
void wait(int iSeconds);
//------------------------------------------------------------------------------
// Main Function with GeoDLL function calls
//------------------------------------------------------------------------------
int main(int argc,char* argv[])
{
// Variables
long int nRet;
unsigned short nTime Zone,nTzType,nFast;
unsigned long nDstStart,nDstEnd,lIsDstActiv,lIsSouthHemi;
double dCoordXQ,dCoordYQ,dEllHgtQ,dCoordXZ,dCoordYZ,dEllHgtZ,dLongitude,
dLatitude,dGeoLon1,dGeoLat1,dGeoLon2,dGeoLat2,dDistance,dAzimut;
float fLocalTime,fUtc,fDst;
char pszCoordQ[20],pszDummy[20],pszTitle[100];
char *ppszVersion,*ppszDummy,*ppszError,*ppszCoordZ,*ppszTzFile,*ppszTime Zone;
// Console title
getdllversion(&ppszVersion);
sprintf_s(pszTitle,100,"KilletSoft GeoDLL %s --- Template with some Function calls",ppszVersion);
SetConsoleTitle(pszTitle);
// Suppress GeoDLL message about shareware version and write it to EventLog
setsilence(true);
// Set GeoDLL internal language to English
setlanguage(2);
// Explanation
printf("You can use all features of GeoDLL in your own application initially free.\n");
printf("However, the number of function calls per program run is limited to 100\n");
printf("geodetic calculations. Also in the free test version a message appears\n");
printf("on the screen or is written to the EventLog and a tone sequence is sounded.\n");
printf("\n");
printf("By purchasing a licence the restrictions will be canceled. For unlocking\n");
printf("you get an user name and an unlock code from KilletSoft.\n");
printf("\n");
printf("The GeoDLL function groups required by your application must be unlocked\n");
printf("in the initialization part of your program with the function setunlockcode().\n");
printf("The function gets the user name and the unlock code as parameters.\n");
printf("\n");
printf("How to do that I will show you here. Of course, these unlock parameters\n");
printf("are fictitious and do not work. Therefore the error message and following\n");
printf("tone sequence are correct in this case!\n");
printf("\n");
printf("nRet = setunlockcode(\"123456789-987654321\",\"MicroModia GmbH\");\n");
printf("if(! nRet)\n");
printf(" geterrorcode(&ppszError);\n");
printf("\n");
// Calling setunlockcode()
// Set the original unlock parameters you got from KilletSoft here:
nRet = setunlockcode(
"123456789-987654321", // char *pszUnlockkey Unlock key
"MicroModia GmbH"); // char *pszLicensee User name
// Output of the results.
if(nRet)
printf("GeoDLL functions unlocked!\n");
else
{
geterrorcode(&ppszError);
printf("GeoDLL functions remain locked!\n");
printf("Error: %s\n",ppszError);
}
// Wait for Key Press or Mouse Click.
wait(60);
//------------------------------------------------------------------------------
// Coordinate Transformations with the function coordtrans()
//------------------------------------------------------------------------------
// Explanation
printf("Now we start transforming coordinates. Here only the use of the GeoDLL\n");
printf("function coordtrans() is demonstrated. But you can also use any other\n");
printf("function for coordinate transformations available in GeoDLL. The required\n");
printf("Coordinate Systems and Reference Systems you find sorted by countries in\n");
printf("the User Manual GeoDLL_e.chm, chapter \"Coodinate Transformations\", in the\n");
printf("file README.DOC or in the Online User Manual.\n");
printf("\n");
// Gauss-Kueger, DHDN --> UTM, ETRS89
dCoordXQ = 2531418.55;
dCoordYQ = 5695935.71;
nRet = coordtrans(
dCoordXQ, // double dCoordXQ
dCoordYQ, // double dCoordYQ
pszDummy, // char *pszCoordQ
(unsigned short)2, // unsigned short nCoordSysQ Gauss-Krueger
(unsigned short)17, // unsigned short nRefSysQ DHDN
&dCoordXZ, // double *dCoordXZ
&dCoordYZ, // double *dCoordYZ
&ppszDummy, // char **pszCoordZ
(unsigned short)3, // unsigned short nCoordSysZ UTM
(unsigned short)4, // unsigned short nRefSysZ ETRS89
(unsigned short)0); // unsigned short nStripZ
// Output of the results.
if(nRet)
{
printf("Gauss-Kueger, DHDN --> UTM, ETRS89\n");
printf("Gauss-Krueger Easting = %f\n",dCoordXQ);
printf("Gauss-Krueger Northing = %f\n",dCoordYQ);
printf("UTM Easting = %f\n",dCoordXZ);
printf("UTM Northing = %f\n",dCoordYZ);
}
else
{
geterrorcode(&ppszError);
printf("GeoDLL coordinate transformation failed!\n");
printf("Error: %s\n",ppszError);
}
printf("\n");
// UTM, ETRS89 -- > UTMRef (Centimeter Grid), ED50 (Europe)
// Note:
// GeoDLL is able to allocate memory for returnable PSZ parameters internally
// and makes them accessible to the calling program by global stored addresses.
// In the calling program then neither memory must allocated nor memory must
// released later. For more information see function setstringallocate().
dCoordXQ = dCoordXZ;
dCoordYQ = dCoordYZ;
nRet = coordtrans(
dCoordXQ, // double dCoordXQ
dCoordYQ, // double dCoordYQ
pszDummy, // char *pszCoordQ
(unsigned short)3, // unsigned short nCoordSysQ UTM
(unsigned short)4, // unsigned short nRefSysQ ETRS89
&dCoordXZ, // double *dCoordXZ
&dCoordYZ, // double *dCoordYZ
&ppszCoordZ, // char **pszCoordZ
(unsigned short)661, // unsigned short nCoordSysZ UTMref
(unsigned short)2, // unsigned short nRefSysZ ED50
(unsigned short)0); // unsigned short nStripZ
// Output of the results.
if(nRet)
{
printf("UTM, ETRS89 -- > UTMRef (Centimeter Grid), ED50 (Europe)\n");
printf("UTMRef grid coordinate = %s\n",ppszCoordZ);
}
else
{
geterrorcode(&ppszError);
printf("GeoDLL coordinate transformation failed!\n");
printf("Error: %s\n",ppszError);
}
printf("\n");
// UTMRef (Centimeter Grid), ED50 (Europe) --> Geographic Coordinates, WGS84
strcpy_s(pszCoordQ, ppszCoordZ);
nRet = coordtrans(
0.0, // double dCoordXQ
0.0, // double dCoordYQ
pszCoordQ, // char *pszCoordQ
(unsigned short)661, // unsigned short nCoordSysQ UTMref
(unsigned short)2, // unsigned short nRefSysQ ED50
&dCoordXZ, // double *dCoordXZ
&dCoordYZ, // double *dCoordYZ
&ppszDummy, // char **pszCoordZ
(unsigned short)6, // unsigned short nCoordSysZ Geo. Coord
(unsigned short)10, // unsigned short nRefSysZ WGS84
(unsigned short)0); // unsigned short nStripZ
// Output of the results.
if(nRet)
{
printf("UTMRef (Centimeter Grid), ED50 (Europe) --> Geographic Coordinates, WGS84\n");
printf("Longitude = %f\n",dCoordXZ);
printf("Latitude = %f\n",dCoordYZ);
}
else
{
geterrorcode(&ppszError);
printf("GeoDLL coordinate transformation failed!\n");
printf("Error: %s\n",ppszError);
}
// Wait for Key Press or Mouse Click.
wait(60);
//------------------------------------------------------------------------------
// Coordinate Transformations with the function coordtransepsg()
//------------------------------------------------------------------------------
// Explanation
printf("For simplicity, it is possible to perform all required settings for the\n");
printf("parameters Coordinate System, Reference System, Meridian Strip, Meridian\n");
printf("Strip Suffix and 2D/3D Modus by using so-called EPSG codes. EPSG is the\n");
printf("acronym for \"European Petroleum Survey Group Geodesy\". This is a working\n");
printf("group of the European oil and gas exploration companies. The EPSG and\n");
printf("their successors OGP \"International Association of Oil and Gas Producers\"\n");
printf("have made it to their task to build a system with globally unique\n");
printf("identitfiers (EPSG codes) for geodetic data, such as Coordinate Reference\n");
printf("Systems, Reference Ellipsoids or Map Projections.\n");
printf("\n");
printf("The required EPSG Codes you find in the User Manual GeoDLL_e.chm, chapter\n");
printf("\"Coodinate Transformations\", in the Online Manual or in the EPSG database.\n");
printf("\n");
printf("This EPSG Codes for Coordinate Reference Systems are used:\n");
printf("31466: EPSG code for \"DHDN / 3-deg. Gauss-Krueger zone 2\"\n");
printf("31466: EPSG code for \"ETRS89 / UTM zone 32N (zE-N)\"\n");
printf("\n");
// Gauss-Kueger, DHDN --> UTM, ETRS89
dCoordXQ = 2531418.55;
dCoordYQ = 5695935.71;
dEllHgtQ = 0.0;
nRet = coordtransepsg(
dCoordXQ, // double dCoordXQ
dCoordYQ, // double dCoordYQ
dEllHgtQ, // double dEllHgtQ Ell. Height not usesed
(unsigned short)31466, // unsigned short nEpsgQ Epsg Code source
&dCoordXZ, // double *dCoordXZ
&dCoordYZ, // double *dCoordYZ
&dEllHgtZ, // double* dEllHgtZ Ell. Height not usesed
(unsigned short)4647); // unsigned short nEpsgZ Epsg Code target
// Output of the results.
if(nRet)
{
printf("Gauss-Kueger, DHDN --> UTM, ETRS89\n");
printf("Gauss-Krueger Easting = %f\n",dCoordXQ);
printf("Gauss-Krueger Northing = %f\n",dCoordYQ);
printf("UTM Easting = %f\n",dCoordXZ);
printf("UTM Northing = %f\n",dCoordYZ);
}
else
{
geterrorcode(&ppszError);
printf("GeoDLL coordinate transformation failed!\n");
printf("Error: %s\n",ppszError);
}
// Wait for Key Press or Mouse Click.
wait(60);
//------------------------------------------------------------------------------
// Time Zone functions
// Activate timezone shapefile with the function settzshapefile()
// or
// activate timezone gridfile with the function settzgridile()
//------------------------------------------------------------------------------
// Explanation
printf("A Time Zone is a region that has an uniform standard time for legal,\n");
printf("commercial and social purposes. Time Zones are primarily longitude\n");
printf("dependent, but secondary they follow the boundaries of countries or their\n");
printf("administrative subdivisions. The Time Zones supported by GeoDLL are based\n");
printf("on an uniform naming convention, designed by Paul Eggert, such as\n");
printf("America/New_York and Europe/Paris. The Time Zones have offsets from\n");
printf("Coordinated Universal Time (UTC) as a number of hours (UTC-12 to UTC+12).\n");
printf("Many higher latitude countries use Daylight Saving Time (DST) for a part\n");
printf(" of the year, typically by changing clocks one hour forward.\n");
printf("\n");
// Download the timezone shapefile or the timezone gridfile from the KilletSoft
// internet site: https://www.killetsoft.de/p_gdlz_d.htm#download.
// Make your changes for the path of the timezone files here.
// You can set the shapefile or the gridfile or nothing. In the last case
// default settings for the further timezone calculations are used.
ppszTzFile = "c:\\programm\\geodll\\timezone\\shape\\geodlltz.shp"; // <== here
nRet = settzshapefile(ppszTzFile); // Path of the timezone shapefile
nFast = 0;
if(! nRet)
{
nFast = 1;
ppszTzFile = "c:\\programm\\geodll\\timezone\\grid\\geodlltz.grd"; // <== here
nRet = settzgridfile(ppszTzFile); // Path of the timezone gridfile
}
// If no timezone file is in use, defaults are used
if(! nRet)
nTzType = 5; // 5 = international timezone if no timezone file in use
else
nTzType = 0; // 5 = national timezone if timezone file in use
//------------------------------------------------------------------------------
// Get Time Zone index from coordinates with function gettznumbycoordfast()
//------------------------------------------------------------------------------
dLongitude = -74.005833;
dLatitude = 40.712778;
if (nFast)
nRet = gettznumbycoordfast(
dLongitude, // double dLongitude
dLatitude, // double dLatitude
nTzType, // unsigned short nTzType
&nTime Zone); // unsigned short *nTime Zone
else
nRet = gettznumbycoordexact(
dLongitude, // double dLongitude
dLatitude, // double dLatitude
nTzType, // unsigned short nTzType
&nTime Zone); // unsigned short *nTime Zone
// Output of the results.
if(nRet)
{
if (nFast)
printf("gettznumbycoordfast() - Get GeoDLL Time Zone index from coordinates\n");
else
printf("gettznumbycoordexact() - Get GeoDLL Time Zone index from coordinates\n");
if (nTzType = 5)
{
printf("Here only an international timzone is calculated, because national timezones\n");
printf("need a gridfile or shapefile, downloadable from the KilletSoft website.\n");
}
printf("Longitude = %f Latitude = %f Time Zone index = %d\n",dLongitude,dLatitude,nTime Zone);
}
else
{
geterrorcode(&ppszError);
printf("Calculation of Time Zone index failed!\n");
printf("Error: %s\n",ppszError);
}
printf ("\n") ;
//------------------------------------------------------------------------------
// Get Time Zone name from Time Zone index with function gettznamebynum()
//------------------------------------------------------------------------------
if (nTzType == 5)
nTime Zone = 8; // 8 = Europa/Berlin if no timezone file in use
nRet = gettznamebynum(
nTime Zone, // unsigned short nTime Zone
&ppszTime Zone); // char **pszTime Zone
// Output of the results.
if(nRet)
{
printf("gettznamebynum() - Get Time Zone name from Time Zone index.\n");
if (nTzType = 5)
{
printf("Here the default national timezone index 8 of Europe/Berlin is used,\n");
printf("because no gridfile nor shapefile is set in GeoDLL.\n");
}
printf("Time Zone Name = %s\n",ppszTime Zone);
}
else
{
geterrorcode(&ppszError);
printf("Calculation of Time Zone name failed!\n");
printf("Error: %s\n",ppszError);
}
printf ("\n") ;
//------------------------------------------------------------------------------
// Get current tz parameters from tz index with function gettzcurrentbynum()
//------------------------------------------------------------------------------
nRet = gettzcurrentbynum(
nTime Zone, // unsigned short nTime Zone
&fUtc, // float *fUtc
&fDst, // float *fDst
&lIsDstActiv, // unsigned long *lIsDstActiv
&nDstStart, // unsigned long *nDstStart
&nDstEnd, // unsigned long *nDstEnd
&lIsSouthHemi, // unsigned long *lIsSouthHemi
&fLocalTime); // float *fLocalTime
// Output of the results.
if(nRet)
{
printf("gettzcurrentbynum() - Get current Time Zone parameters from Time Zone index\n");
printf("UTC = %+3.1f DST = %+3.1f DST in effect = %s Current UTC+DST = %+3.1f\n",
fUtc,fDst,lIsDstActiv ? "yes" : "no",fLocalTime);
printf("DST start date (yyyymmdd) = %d DST end date (yyyymmdd) = %d\n",nDstStart,nDstEnd);
}
else
{
geterrorcode(&ppszError);
printf("Calculation of Time Zone parameters failed!\n");
printf("Error: %s\n",ppszError);
}
// Wait for Key Press or Mouse Click.
wait(60);
//------------------------------------------------------------------------------
// Distance and bearing calculations
// Distance calculation with the function distancegeo()
//------------------------------------------------------------------------------
// Explanation
printf("Often it is necessary to calculate the distance between two points fast and\n");
printf("accurate. For example this is necessary for the realization of a radial search.\n");
printf("Here I introduce the function distancegeo(), which calculates the distance\n");
printf("between two Geographic Coordinates on the earth ellipsoid.\n");
printf("The point2pointgeo() function calculates the coordinates of a destination point\n");
printf("from the coordinates of the start point, the forward bearing and the distance\n");
printf("between the points.\n");
printf("\n");
dGeoLon1 = 11.55; // Geographic longitude of the 1th point
dGeoLat1 = 51.32; // Geographic latitude of the 1th point
dGeoLon2 = 14.03; // Geographic longitude des 2nd point
dGeoLat2 = 53.48; // Geographic latitude of the 2nd point
nRet = distancegeo(
dGeoLon1, // double dGeoLon1
dGeoLat1, // double dGeoLat1
dGeoLon2, // double dGeoLon2
dGeoLat2, // double dGeoLat2
&dDistance, // double *dDistance
(unsigned short)10); // unsigned short nEllipsoid (10 = WGS84)
// Output of the results.
if(nRet)
{
printf("distancegeo() - Calculate distance between two coordinates\n");
printf("Longitude of 1th point = %f Latitude of 1th point = %f\n",dGeoLon1,dGeoLat1);
printf("Longitude of 2nd point = %f Latitude of 2nd point = %f\n",dGeoLon2,dGeoLat2);
printf("Calculated distance between points = %f\n",dDistance);
}
else
{
geterrorcode(&ppszError);
printf("Distance calculation failed!\n");
printf("Error: %s\n",ppszError);
}
printf ("\n") ;
//------------------------------------------------------------------------------
// Calculation of a target point coordinate with point2pointgeo()
//------------------------------------------------------------------------------
dGeoLon1 = 11.55; // Geographic longitude of the start point
dGeoLat1 = 51.32; // Geographic latitude of the start point
dDistance = 521434; // Distance to the target point in meter
dAzimut = 122.5; // Forward azimutal bearing
nRet = point2pointgeo(
dGeoLon1, // double dGeoLon1
dGeoLat1, // double dGeoLat1
dDistance, // double dDistance
dAzimut, // double dAzimut
&dGeoLon2, // *double dGeoLon2
&dGeoLat2, // *double dGeoLat2
(unsigned short)10); // unsigned short nEllipsoid (10 = WGS84)
// Output of the results.
if(nRet)
{
printf("point2pointgeo() - Calculate target coordinate from start coordinate and distance\n");
printf("Longitude of start point = %f Latitude of start point = %f\n",dGeoLon1,dGeoLat1);
printf("Bearing to dest. point = %f\n",dAzimut);
printf("Dist. to the dest. point = %f\n",dDistance);
printf("Longitude of dest. point = %f Latitude of target point = %f\n",dGeoLon2,dGeoLat2);
}
else
{
geterrorcode(&ppszError);
printf("Coordinates and bearing calculation failed!\n");
printf("Error: %s\n",ppszError);
}
// Wait for Key Press or Mouse Click.
wait(60);
return 0;
}
//------------------------------------------------------------------------------
// Function wait() generates a waiting time of iSeconds seconds. The waiting
// time is interrupted when a key or a mouse button has been pressed.
// Clears the screen after waiting ans sets the cursor to the screens top.
//------------------------------------------------------------------------------
void wait(int iSeconds)
{
// Variables
clock_t clWait;
unsigned long nNumEvent,nWritCells,nNumCells;
HANDLE hConsole;
INPUT_RECORD irBuffer;
COORD coScrPos = {0,0};
CONSOLE_SCREEN_BUFFER_INFO csbInfo;
// Calculate waiting time
clWait = clock() + iSeconds * CLOCKS_PER_SEC;
// Show waiting hint
printf("\n");
printf("Please click mouse or press a key!");
// Remove all still existing events from the console
hConsole = GetStdHandle(STD_INPUT_HANDLE);
FlushConsoleInputBuffer(hConsole);
// Stop waiting time on mouse click or key press
while(clock() < clWait)
{
nNumEvent = 0;
if(GetNumberOfConsoleInputEvents(hConsole,&nNumEvent) && nNumEvent > 0)
{
nNumEvent = 0;
if(ReadConsoleInput(hConsole,&irBuffer,1,&nNumEvent) && nNumEvent == 1)
{
if(irBuffer.EventType == MOUSE_EVENT)
{
if(irBuffer.Event.MouseEvent.dwButtonState == FROM_LEFT_1ST_BUTTON_PRESSED)
break;
else if(irBuffer.Event.MouseEvent.dwButtonState == RIGHTMOST_BUTTON_PRESSED)
break;
}
else if(irBuffer.EventType == KEY_EVENT)
{
if(irBuffer.Event.KeyEvent.bKeyDown)
break;
}
}
}
// Wait 1/10 second to remain processor load low.
Sleep(100);
}
// Clear screen
hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
GetConsoleScreenBufferInfo(hConsole, &csbInfo );
nNumCells = csbInfo.dwSize.X * csbInfo.dwSize.Y;
FillConsoleOutputCharacter(hConsole,' ',nNumCells,coScrPos,&nWritCells);
// Cursor at screen top
SetConsoleCursorPosition(hConsole,coScrPos);
return;
}
In order that you are always well informed about our company, we write actual news, current information and special offers here into this column.
Read the Press Release...
Read more...
The EU Business News Magazine from Great Britain has given the "EU Business Award 2020" to KilletSoft.
Read the Award...
Read the Press Release...
Read the Press Release...
Read the Worksheet...
Read the Press Release...
To the NTv2 collection...
Read the Worksheet...
Read the Worksheet...
new languages can be added at any time by creating new language files.
Everybody who is interested can translate a new language file into his native language for himself and all users.