From: Charles K. <cha...@sr...> - 2014-01-10 13:50:45
|
Ben, * You need to convert geocentric coordinates to geographic coordinates using the Geocentric class (Geocentric::WGS84 is a static instance for the WGS84 ellipsoid). * UTMUPS::Forward converts from geographic coordinates to UTM (or UPS near the poles). This knows the rules for zone assignments (including the Norway and Svalbard exceptions and the UTM/UPS boundary). The "setzone" argument to this function lets you override the standard assignment. * UTMUPS::EncodeEPSG converts a zone+hemisphere to an EPSG code. * The TransverseMercator class just does the actual projection. UTMUPS calls this class and additionally takes care of the zone and the false origin. Typically you won't need to invoke the TransverseMercator class directly * The TransverseMercatorExact class is a variant of TransverseMercator which allows the projection to cover the entire globe. You don't need to use this if you're just converting to UTM. * The geodetic height returned by Geocentric::WGS84.Reverse is the height above the ellipsoid. This might be what you want. (There's no such thing as "UTM height".) If you need the height about the geoid, use the Geoid class to determine the height of the geoid above the ellipsoid. You will need to install the data for the geoid, see http://geographiclib.sourceforge.net/html/geoid.html * "Latitude", without further qualification, always mean geographic (geodetic) latitude in GeographicLib. * My guess is the GeographicLib is a better fit to your needs than proj.4. The strength of proj.4 is in dealing with a wide range of projections. Here's the outline of what you want to do. See also the example code for the Geocentric and UTMUPS classes. #include <GeographicLib/Geocentric.hpp> #include <GeographicLib/UTMUPS.hpp> #include <GeographicLib/Geoid.hpp> using namespace GeographicLib; double X = ..., Y = ..., Z = ...; double lat, lon, hae; Geocentric::WGS84.Reverse(X, Y, Z, lat, lon, h); int zone; bool northp; double x, y; UTMUPS::Forward(lat, lon, zone, northp, x, y); int epsg = UTMUPS::EncodeEPSG(zone, northp); Geoid egm96("egm96-5"); hmsl = hae + Geoid::ELLIPSOIDTOGEOID * egm96(lat, lon); On 01/10/2014 06:38 AM, Ben Adler wrote: > Hello GeographicLib, > > I'm rather new to geodesy and trying to project ECEF/geocentric > coordinates into UTMUPS/WGS84 with the height given relative to the > WGS84 ellipsoid. And I have a few questions: > > 1) For a given set of ECEF coordinates, I first need to get the > corresponding UTM zone's central meridian and description. This might > sound trivial at first, but then there's Norway and all the other > exceptions close to the north pole. And there's UPS for the poles. > > a) How can I do this with GeographicLib? Which classes/methods should > I use? > > b) How can I get the WKT or EPSG code for the chosen UTM/UPS zone? > > 2) Looking at GeographicLib::TransverseMercatorExact, it seems I must > input lat/lon in order to retrieve the desired UTM coordinates. This > means I must first convert ECEF into geodetic, which is also handled by > GeographicLib. But, > > a) do I need to input geodetic or geocentric latitude? > > b) The docs say "The latitude of origin is taken to be the equator". > While true for northern zones, Does that mean I need to introduce a > false northing (of -10M meters) in southern zones when using GeographicLib? > > c) can I just re-use the geodetic WGS84 height as UTM height without > conversion? I think so, but I have erred often in the past :) > > I'm not sure whether GeographicLib is suited to my needs, or whether I > should use another lib for this, e.g. PROJ.4. Any hints on this? > > thanks! > ben > _______________________________________________ > Geographiclib-users mailing list > Geo...@li... > https://lists.sourceforge.net/lists/listinfo/geographiclib-users > |