Site Map: | [GPSy Home Page] [GPS Resource Library] |
One note of caution is reflected in Richard Koolish's message below. Depending on the geodetic datum used, your results vary when performing coordinate system transformations. Chuck Gantz's C source listed below allows you to select which datum you wish to perform the conversion in; and even handles the Swiss Grid.
Perhaps the best source code to steal/utilize is the free MacGPS source which is on Peter Bennet's GPS Resource site. It has routines to translate to and from UTM, Lat/Lon, ITM, OSGB, UPS, etc. People have ported MacGPS to LINUX/Windows/NT and other inferior operating systems, so you can find plenty of source code to work with based on MacGPS.
If all you need to do is run the calculations between geographic (lat/long) and UTM coordinates, then use either the Lotus 1-2-3 / Excel spreadsheet below, or:
The Coordinate System Overview is an exellent overview of why various coordinate systems and datums exist.
The book that should be on every coordinate system programmer's shelf is:
Map Projections - A Working Manual John P. Snyder. USGS Professional Paper 1395.
This text as well as a list of other "required reading" in GPS and cartography can be found in the GPS Bibliography.
I welcome contributions and additions to this page via e-mail at: karen@gpsy.com. However, due to my full-time jobs as a Macintosh GPS systems developer and sociocultural anthropologist, I am unable to provide much assistance beyond what is already covered on this page. I would suggest posting to the newsgroups or hiring a consultant (in which case I would be available: my time is your time if my time is your money).
For information on transformations to other grid systems:
Hi - I was wondering if there was a computationally simple way to produce UTM readings given lat/lon. Is there something simple? Alternately, can someone recommend a good textbook on the different map systems (and conversion principles)?
Source Code
Date: Fri, 05 Jun 1998 14:32:23 -0700 From: "Chuck Gantz" chuck.gantz@globalstar.com To: Karen Nakamura Subject: UTM to Lat/Long conversion Hi Karen, I've gotten several request for the inverse transformation from the one that I [originally] gave you the code for, in other words the UTM to Lat/Long direction. People on the newsgroup keep asking for that too. So I finally got around to writing the code for that. transformation. I wrote that code, and modified the original code, to do the calculations for any of the 23 reference ellipsoids listed in Peter Dana's GPS website. The code is a little bit longer than the original one, but it's not to bad. there's also a short program that I used to test the code. If you would like to put this on your website, here is the code. [In response to a question about the Swiss Grid, Chuck adds:] I figured out half the Swiss Grid problem. I saw the reference to PROJ.4 in one of the replies to your question in the newsgroup. I then went in to the PROJ.4 ftp site and downloaded the Swiss Grid reference. Then I went through the source code to try to find out where the CH1903 datum came into the picture. The source code is just about unreadable, being made up mostly of #defines for all the functions. Eventually though I figured out that the CH1903 datum is referenced to the Bessel reference ellipsoid. This is what is needed for the transformation. Anyways, I wrote the code to do the forward projection, which turned out not to be to bad. I checked it out against some locations I found on the web. Luckily the Swiss like to put both their lat/long and Swiss Grid coordinates on their websites. Two of the locations were within about a meter, the third within about 5 meters. I added this to my original UTM code, and moved some of the stuff in those files around to allow the ellipsoids and some constants to be shared. I put the source for the lat/long to Swiss Grid here just in case you can't read attachments, and I'm attaching all of the files to the email, just in case you can. Any problems, let me know. [The Swiss Grid code has now been amended by Chuck to include both forward and inverse solutions.] Chuck Gantz Enclosures: LatLong-UTMconversion.cpp (view online as text file) LatLong-UTMconversion.h (view online as text file) UTMConversions.cpp (view online as text file) SwissGrid.cpp (view online as text file) constants.h (view online as text file)
Date: Sat, 5 Oct 1996 10:44:05 +0100 From: Steve Metcalfe (metcalfe@fermac.com) To: Karen Nakamura (karen.nakamura@yale.edu) Subject: Re: Lat/long to UTM? There is a Fortran 77 source programme (which sets out the logic) on http://vancouver-webpages.com/peter/index.html Hope this helps Steve metcalfe@fermac.com
Date: Tue, 8 Oct 1996 10:45:32 -0400 From: "Donald J. Stierman" (dstierm@topaz.geology.utoledo.edu) To: karen.nakamura@Yale.edu Subject: Lat/Long to UTM Karen - I've a spreadsheet that does this - 1-2-3 for Windows, Excel will probably accept the file. I think I found the equations in Snyder (1987) Map Projections - A Working Manual, USGS Prof. Paper 1395 (or from the other book located next to it on our library shelf, can't recall the name right now). [For a list of other texts and purchasing info, see the GPS Bibliography] If you wish, I'll attach the spreadsheet file to an e-mail message - can you download attached files and will your spreadsheet load a Lotus 1-2-3 file? [Here are the attachments] UTM.wk4 -- Lotus 1-2-3 format (10K) UTM.wk4 -- Lotus 1-2-3 format (uuencoded; 14K) UTM.xls -- Microsoft Excel format (25K) UTM.xls.uu -- Microsoft Excel format (uuencoded; 36K) UTM.hqx -- Microsoft Excel 5.0 for Macintosh format (BinHQX; 39K) [end attachments] Regards - Don Stierman, Associate Professor
From: John Ceccherelli To: Karen Nakamura Subject: Lat/Long - UTM Conversion Date: Fri, 7 Nov 1997 09:24:55 -0500 Karen, I noticed your reply to a question about lat/long to UTM on the sat-nav usenet. I have a Lotus 1-2-3 worksheet which does this conversion as well as several other utilities. It's small so it can be used on PDAs like the Casio, Sharp, and HP200LX. It's freeware with no strings attached. I was wondering if you would check it out and if possible add it to your web page? I get about 10 to 20 requests a month for it and it desperately needs a home but I don't a place to put it. I've attached a UUENCODE PKZIPPED file that contains the worksheet and documentation. As you can see, it's pretty small. Thanks, John Ceccherelli [Here are the attachments] mapxv2.doc Documentation (MSWord file; 20K) mapxv2.doc.uu Documentation (MSWord; uuencoded; 27K) mapxv2.wk1 Excel sheet (12K) mapxv2.wk1.uu Excel sheet (uuencoded; 16K) mapx.zip -- Zip file (12K) mapx.zip.uu -- Zip file uuencoded (16K) [end attachments]
Date: Mon, 7 Oct 96 15:43:26 EDT From: koolish@BBN.COM To: karen.nakamura@yale.edu Newsgroups: sci.geo.satellite-nav, sci.geo.geology Subject: Re: Lat/long to UTM? The Proj.4 library has many conversion routines, including UTM. I think the ftp address is kai.er.usgs.gov/pub/PROJ.4. The best book is "Map Projections - A Working Manual" by John P. Snyder. USGS Professional Paper 1395. [For a list of other texts and purchasing info, see the GPS Bibliography] Lat-Lon to UTM is complicated by the fact that both lat-lon and UTM coordinates are relative to the datum from which they were determined, so you have to be careful. If you get WGS84 lat-lon out of a GPS and convert to WGS84 based UTM, it won't match a map with a NAD27 UTM grid.
Date: Sat, 5 Oct 1996 10:06:13 -0700 (MST) From: [anonymous by request] To: Karen Nakamura (karen.nakamura@Yale.edu) Newsgroups: sci.geo.satellite-nav, sci.geo.geology Subject: Re: Lat/long to UTM? I am currently programming this [as well]. What it boils down to is the error your application can tolerate, the more error, the simpler the computation. I accept any error under one meter, which results in sub-cm errors. Lousy Fortran code is available from ftp://ftp.ngs.noaa.gov/pub/pcsoft/corpscon/ and it is the full-blown version with errors less than .1mm. Best of luck, [Anonymous]
Books
Date: Mon, 07 Oct 1996 11:15:25 -0500 From: [Anonymous by request] To: Karen Nakamura (karen.nakamura@Yale.edu) Newsgroups: sci.geo.satellite-nav, sci.geo.geology Subject: Re: Lat/long to UTM? A very good book on the subject, with plenty of conversion formulas, is Snyder, J. P., "Map Projections Used by the U. S. Geological Survey", 2nd edition, Geol. Survey Bulletin 1532, 313 p., U. S. Government Printing Office, Washington, D. C., 1982. [For a list of other texts and purchasing info, see the GPS Bibliography]
Commercial Software
Date: Mon, 07 Oct 96 09:15:54 GMT From: Jose Manuel Martinho Lourenco (j_louren@utad.pt) To: karen.nakamura@Yale.edu Subject: Re: Lat/long to UTM? Hello! Rockware as the GEOPAL. One of the calculations he does is the conversion LAT/LON in UTM coordinates. You can find more in the site: http://www.rockware.com/rockware/ Bye Martinho ______________________________ Jose Manuel Martinho Lourenco Seccao de Geologia Univ. Tras-os-Montes e Alto Douro Apartado 202 5001 Vila Real-Portugal-Codex Telf: 351-59-320279 Fax: 351-59-320480 EMAIL: j_louren@utad.pt
Date: Tue, 8 Oct 1996 12:14:45 +0100 From: Guillermo Ortiz (gortiz@lander.es) To: karen.nakamura@yale.edu Subject: Long/Lat to UTM Hello Karen: Answering your first question in your article posted to sci.geo.geology, I'm using the multipurpose program ROCWORKS Rev. 7.07 by Rockware Inc. 2221 East Street, Golden CO 80401 FAX: 303-278-4099. It's a very simple package for geological data treatment that include the transformation Long/Lat -> UTM and UTM-> Long/Lat. [Rockware Europe's URL is http://www.bart.nl/~rockware/] Good Luck! Guillermo
From: Michael Wild To: karen@gpsy.com Subject: Converting Latitude/Longitude to Universal Transverse Mercator (UTM) Date: Sat, 18 Oct 1997 23:45:59 +0100 MIME-Version: 1.0 Karen, NIMA's MADTRAN does this and much more. It deserves a mention on your page. Check out http://164.214.2.59/publications/guides/MADTRAN/. It appears to come with complete source code. It is worth adding that NIMA's Geodesy for the Layman http://164.214.2.59/geospatial/products/GandG/geolay/toc.htm is a good and comprehensive (and free on the net) introduction to the issues involved in different coordinate systems and datums. The AUSLIG Gedesy page at http://www.auslig.gov.au/geodesy/geodesy.htm also has good information. -- Michael Wild
From: "James H. Maynard" Newsgroups: sci.geo.satellite-nav Subject: Re: Mercator Software Date: Tue, 11 Nov 1997 02:34:57 -0800 To: Patrick Di Justo Patrick Di Justo wrote: > Can anyone point me to a software package (preferably freeware or > shareware) that can take a flat rectangular image map and distort it > into one of those mercator projection maps that seem to be made of a > series of long vertical ovals??? I've got a digital map of the planet > Earth that I'd like to print out and wrap around a sphere to make a > globe, and If I'm not mistaken, only one of those ovoid mercator > projections will work..... I am sorry Patrick, but I find your terminology confusing.There is no such thing as a "Mercator projection map" that is also "made of a series of long vertical ovals." Nor is there any map projection with the name "ovoid mercator projection." I think you are probably talking about the UTM, Universal Transverse Mercator, projection (really, series of projections). A transverse Mercator projection is like the ordinary Mercator projection, but is based on the idea of wrapping a cylinder around the sphere or ellipsoid (used to represent the earth) not touching the sphere at the equator, as in the normal aspect of the Mercator projection, but along a meridian. Just as the normal aspect Mercator projection has low distortion of scale near the equator, so does a transverse Mercator projection have low scale distortion near its central meridian. With the UTM system, the earth is divided into 60 zones of longitude, each 6 degrees of longitude wide. Zone 1 has its western boundary at 180 degrees W, with its central meridian at 177 degrees W, and its eastern boundary at 174 degrees W. Likewise, zone 2 has its central meridian at 171 degrees W, zone 3 at 165 degrees W, and so on. I live near 123 degrees W, which is the central meridian for UTM zone 10. Since you are interested in constructing a globe, which is a *very* small scale map, you can model the earth as a sphere and use the spherical, rather than the ellipsoidal formulation of the transverse Mercator projection. For the formulas for the projection, you should consult the late John P. Snyder's excellent tome, "Map Projections - A Working Manual." For illustrations of a wide variety of map projections, see his "An Album of Map Projections." Both were published by the U.S. Geological Survey. I purchased my copy of the former from the Navtech bookstore; see their web page at "http://www.navtechgps.com". I found my copy of the "Atlas of Map Projections" at a local navigational chart agent, of all places. (I only saw it there once, the day I bought it.) I expect both could be purchased through "http://www.amazon.com". "Map Projections - A Working Manual" gives you the (sometimes rather tedious) formulas for both the spherical and ellipsoidal cases of all the major map projections. Unless you are planning to write your own software, just look at this book in a library. You don't have to read all the math; the text introduction to Mercator's projection is quite readable. If you ever *do* want to write your own map projection software, though, you really should have this book in your personal library. The "Album of Map Projections" is a most entertaining book. It gives illustrations of a *wide* variety of map projections and tells you how to distinguish one from another. All the major projections are covered, as well as many minor, but entertaining ones. There are illustrations of conformal mappings of the world onto a square, onto a triangle, onto an ellipse. {I found the "Craig Retroazimuthal" project most entertaining. Locate yourself on a Craig Retroazimuthal projection map, and and use a protractor to measure the angle on the map from north to the center of the projection. This is easy to to do since all meridians are represented as parallel straight lines. The angle you measure off the map is the great circle bearing from your position to the center of the projection. Very handy for travelling Muslims who want to keep track of the direction to Mecca!) But back to your question. The part of a sphere's surface which is bounded by two meridians is called a "gore." (It is *not* an oval or an ellipse.) One way to manufacture a globe is to divide the sphere into several gores (usually 24, each between bounding meridians that are 30 degrees apart). Then print the map for each gore using a conformal map projection, such as a transverse Mercator projection centered on the central meridian for that gore. Then paste the gores together onto your spherical surface. The more gores there are, the easier it is to make the paper stretch (when moist) to fit the sphere - but the more tedious is the job of pasting! Using the UTM projection for this would be tedious, as there would be *sixty* gores to print and paste! There are a variety of map projection software packages out there, and most support the transverse Mercator projection. I use the "Geographic Calculator" from Blue Marble Geographics. I believe the National Geodetic Survey has some software you can download from their site. (It will be for an ellipsoidal model of the earth, though, and thus overly complicated for your purpose of constructing a globe.) It should be easy enough, though, to just use the formulas from Snyder for the spherical case of a transverse Mercator projection. -- (To send me e-mail you must remove "nospam." from my address.) Jim Maynard (K7KK) at Salem, Oregon, USA e-mail: jmaynard@teleport.nospam.com boat: "Ruddy Duck," a Doughdish (Herreshoff 12) motto: "Ignorance is the mother of Adventure" - Hagar the Horrible
Copyright (C) 1996-2000 by Karen Nakamura. All rights reserved. This page was created on October 9th, 1996 and last updated on February 1, 2000. We've had hits since we relocated on April 8th, 1997.