Sample project files - 10 Kb
A simple WebForm example using UTM and Lat/Long.
This sample converts Latitude and Longitude values into UTM Northings and Eastings. In the process it demonstrates the use of a Simple WebForm events firing back to the server.
Chuck Gantz and John McTainsh
Here is a simple example of a WebForm that converts Lat-Long values to UTM
and vice versa. The conversion routines were converted from C++ kindly provided
by Chuck Gantz. The WebForm simply provides an easy way to wrap these routines.
To see the project in action go to http://www.mctainsh.com/LatLongUtm.
Building the Project.
In this sample was built using Visual Studio.NET 7.0. Here we will cover
building and running the WebForm.
- First create a folder under
wwwroot with the name
- Ensure security is set to enable web sharing.
- Using "Internet Service Manager". Right click on the
LatLongUtm folder and Create an application name of the same.
- Using Notepad edit the LatLongUtm.csproj.webinfo file and change
to the name of you machine.
- Start Visual Studio.NET and choose "File->Open Solution".
- Try to build the project. An error will occur.
- Accept the error and save the
LatLongUtm.sln file to
- Right click on
LLUtmForm.aspx in the VS Solution Explorer
and "Set As Start Page".
- Select "Debug->Start without debugging" and the page should
Getting Debugging Working.
Once we are this far we can track the process by setting break points and
stepping through them. To do this we must enable debugging.
- Right click on the Project in "VS Solution Explorer" and
- Choose "Configuration Properties \ Debug".
- Set "Enable ASP.NET debugging" to True.
- Insert a breakpoint and choose "Debug->Start" to run to it.
Some interesting points.
The "To UTM" and "To Lat-Long" radio buttons fire back to the server to disable
the edit boxes. This is done by setting the "AutoPostBack" to true and
creating a handler for it to call Enable and set the edit's background colour.
The Ellipsoid class is defined in the same namespace.
Double.Format command is used to format the output with an embedded thousands
Values are passed back in function parameters by reference using the
The Latitude and Longitude values are entered in decimal format.
Special thanks to Chuck Gantz for allowing me to use his excellent conversion
routines. The majority of the code behind this example was provided by Chuck and
any bugs were probably added by me.