spacer2 1_1 1_2
 The MP2K Update!
Front Cover
What's New
Sample Data
MapPoint 2013
Press Releases
MapPoint Forums
Link to MP2Kmag
Wish List
MapPoint Trial
 Earlier Content
Past News Items
Past What's New Announcements

MapPoint 2013

Programming MapPoint in .NET

MapPoint Book

  Spatial Community
SVG Tutorials

Map Visitors


Geodesy: MapStuff Release version 0.9

Windsway Company is releasing some Geodesy oriented software as open souce code. This is not a complete application but rather a set of routines that you can use to build your own applications.

[Ed. Note: see the forum for the latest version.]

At least two functions in MapStuff.bas are of particular interest to MapPoint users. The first is Vinverse which is a highly accurate way to find the distance between two points when you know the latitude and longitude of the two points. The second is Vdirect that will give you the latitude and longitude of a second point when you know the distance and azimuth from a given point. Both of these functions consider the earth as an ellipsoid and you get to pick your map datum (WGS84 for MapPoint). Many other useful routines are in here as well.

The release consists of two open source files:


Both files must be included in your Visual Basic® project. Download the entire package here.

Geodesy Class file:

The class file (.cls) contains the physical definitions of the supported datums and methods for retrieving the desired datum. Normally you need not use these methods at all as the functions that need the datum dimentions contain the necessary code to do this. However there is a function you can call to get the data.


Mapstuff is the file that contains all the action. There are routines for converting Latitude/Longitude to UTM coordinates and UTM Coordinates to Latitude/Longitude. There are implementations of T. Vincenty's Direct and Inverse Solution of Geodesics on the Ellipsoid. There are standard VB data structures called Types that are used throughout Mapstuff.These Types add order to the calling sequences of most of the routines. All Types and Routines are public. All the main functions return an error code of type Integer to flag success or failure. The error codes are constants in the definition section of the code. The code names all begin with WIC (for Windsway Instrument Company) and are ALWAYS Capitalized. A fuction returning WICNOERROR has completed successfully (this does not necessarily mean that the information returned is meaningful). Any other error code means something went wrong during the function call. The return codes for each function are documented in a comment block at the beginning of the function.

Mapstuff.bas contains the following routine for your use:


These four routine simply implement the trigonometric function in a way that is standard to my way of doing software.


This function compute the zone data for any UTM zone. It expects a Type ZoneStruct and populates it with information concerning the UTM zone of interest. As with all the main functions in Mapstuff.bas, the function returns an error code of type Integer that signals success or failure.

Given the latitude and longitude of a place, ComputeZone will return the UTM central longitude of the place along with the zone number and zone letter of the place.


DegToRad converts an angle in decimal degrees to radians and RadToDeg converts an angle in radians to decimal degrees.


DtoDMS converts an angle in decimal degrees to it constituant parts; degrees, minutes and seconds. These components are returned a a DMS structure (byref). DMSToD converts an angle from degrees/minutes/seconds to decimal degrees.


Sex2Deg converts an angle expressed in sexigesimal format: dd.mmsssss where dd is degrees, mm is minutes and sssss represents ss.ssss seconds into decimal degrees: dd.ddddd

The function assumes that minutes are expressed as two digits and the first two digits of ss are the whole seconds and the balance of ssssss are the decimal portion. The decimal portion of ssssss can be expressed to any reasonable number of places. Therefore dd.mmssssss expresses an angle of dd degrees mm minutes and ss.ssss seconds


FmtDMS converts decimal degrees dd.ddddd into a string dd mm ss.ssss or time expressed as hh.hhhhh into a string hh mm ss.ssss with the appropriate symbols i.e. 23° 34' 45.5678" or 23h 34m 45.5678s. User specifies degrees or time and the number of decimal places for seconds. Decimal range from 0 to 5. If more than 5 places is specified, places is set to 5. FmtDMS is intended for printing or display purposes.


This function extracts the ellipse data for the requested datum from the arrays in the class file Geodesy.cls. It returns the ellipse's major and minor axes as well as the ellipsoid name in an EllipseStruct.


This function extracts the datum data for the requested datum from the arrays in the class file Geodesy.cls. It returns the datum information in a DatumStruct. The intent of the inclusion of the datum data is to allow the user of an application to get to the ellipsoid information through datum name which is commonly used in GPS receivers. The datumNumber is geoid number for the ellipsoid associated with the named datum.

Suggested use: Read the datumNames into a list box in your application and allow the user to select one and use its ListIndex+1 as the index for GetDatumStuff. Then use the datumNumber as the geoid number to get to the underlying ellipse data eMajor, eMinor and eName using GetEllipseStuff


These functions are implementations of the algorithms presented in the USGS Professional Paper 1395 "Map Projections - a Working Manual" by John P. Snyder.

LL2UTM converts a position defined by a latitude/longitude pair to it's correspond UTM coordinates using a datum of the user's choice. The function returns the requested information in a UTMStructure and returns the error code WICNOERROR if no errors encountered in the conversion.

UTM2LL converts a position described by a UTM Easting/Northing and zone to it's corresponding latitude/longitude. The requested information is returned in a UTMStructure and the function returns WICNOERROR if successful.


These functions attempt to constrain their arguments to specific ranges.

ModAzimuth constrains an angle (in radians) to the range of 0 <= angle <= 2*PI (0 to 360 deg). It is used for azimuths.

ModLatitude constrains an angle (in radians) to the range -PI/2 <= angle >= +PI/2 (-90 deg to +90 deg). It is used for latitudes

ModLongitude constrains an angle (in radians) to the range -PI <= angle >= PI (-180 deg to +180 deg). It is used for longitudes

Modulus is my implementation of the Mod function. It returns the remainde of the division of x/y.


This function returns the reciprocal of an azimuth. Azimuth is in decimal degrees.


This function returns the square of a value, i.e. Square(x) = x * x


These funcitions are the implementation of Vincenty's algorithms.

Given the latitude and longitude of a point and the azimuth and distance to a second point, Vdirect returns the latitude and longitude of the second point and the azimuth of the first point from the second. The computed data is returned in a GeoStructure. The distance is returne in meters and the azimuth is the angle measured from true north.The function returns the standard WICNOERROR if successful.

Given the latitude and longitude of two points, Vinverse returns the distance between the two points in meters and the azimuth of each point from the other. These azimuths are NOT reciprocals. The functions returns the standard WICNOERROR if successful.

Unzip the contents of Geodesy.Zip into a folder where you wish to run the sample stuff. I have the VB project in a folder Geodesy on the VB path. This will create a sample project for you to use to test the code.

I have included some simple code to illustrate how these routines might be used in a VB program. Cut and paste the Command1.Click and code (files Testxxx.txt) into the Geodesy project's (Geodesy.vbp) GeoTest.frm module in place of the ones that is currently there and run the program from the IDE.

If you have questions I will try to field them, but I can't guarantee an instant response nor will I write complete projects for you. I would like to hear about any additions you make to my code. Send the source code please.

Remember this is an open source project and you are obligated by the license to share the code and any improvements with anyone who would like a copy. Please read the licensing agreement at the site documented in the code.

To stay informed of future updates to the library, send me and an e-mail with Geodesy in the subject line and I'll add you to the distribution list.

Discuss this story in the forum.

Author: Vic Fraenckel
Email: vfraenc1(AT)
Vic is the Owner/President of Windsway Instrument Company which manufactures the WindReader, an instrument for measuring wind speed and direction at various levels in the atmosphere. He has been interested in the mathematics of mapping as a hobby for many years.

His current quest is for a suitable sailboat for live-aboard cruising and he also acts as a technical advisor for a long distance gas balloon racing team. He is a ham radio operator - callsign KC2GUI.

MP2Kmag Internet

 Recent Discussion
Browse GIS books and periodicals
Find a MapPoint Partner or Consultant
Real Estate Columbia, MO

Want Your Site To Appear Here?

   © 1999-2012 MP2K. Questions and comments to:
  Microsoft and MapPoint 2002/2004/2006/2009/2010/2011/2013 are either trademarks or registered trademarks of Microsoft.