180 likes | 452 Views
An Open-Source, Object-Oriented General Cartographic Transformation Program (GCTP). Michael S. Williams, Michael P. Finn *, and Robert A. Buehler** United States Geological Survey National Geospatial Technical Operations Center. * Presenting author
E N D
An Open-Source, Object-Oriented General Cartographic Transformation Program (GCTP) Michael S. Williams, Michael P. Finn*, and Robert A. Buehler** United States Geological Survey National Geospatial Technical Operations Center * Presenting author ** Now with University of Missouri – Rolla, Department of Computer Science
Outline • Motivation • Goals • Background • Design • Class Structure • Interface • Adding New Projections • Conclusions • References
Motivation • Object-Oriented software development popularity growing • Many existing libraries written in procedural languages (C, for example) • Many current solutions involve using these procedural libraries within object-oriented frameworks (i.e. “wrapping” them) • Preferable to have a natively object-oriented library to use
Goals (Do’s and Don’ts) • Don’t completely reinvent the wheel • Don’t just make a wrapper • Do use existing algorithms • Do make it simple to use • Do make it easy to extend
Background • General Coordinate Transformation Package (GCTP) • Originally written in Fortran • Later converted to C • Still very widely used
Background • Original GCTP interface very cumbersome.
Background • Original interface uses 19 parameters! • Calling the gctp function results in much redundant code execution. • How can we improve this?
Design • Simple Design • Each supported projection contained in a single class. • Each object inherits from the base class “Projection”. • Projection class provides a common interface.
Design • What’s old and what’s new • Old • Still supports the use of the 15 element projection parameter array. • Core projection algorithms exactly the same. • New • Supports the use of get / set functions to view and modify projection parameters. • No more 19 parameter function calls!!
Design Parameter Array Variable Declarations Output Units Datum Object Instantiation Forward Transformation Inverse Transformation
Design Setting Parameters
Adding New Projections • Basic Steps • 1.) Derive a new class from “Projection” • 2.) Implement the protected _init(), _forward(), and _inverse() functions. • 3.) If the new projection uses specific entries in the parameter array, implement the _loadFromParams() function.
Adding New Projections (example) Constructors Core Projection Function Declarations
Adding New Projections (example) Transformation results must be stored in m_x_coord and m_y_coord, which are inherited from the “Projection” base class.
Adding New Projections (example) First, a call must be made to the base class parameter loading function Here, the UTM specific parameters are pulled from the parameter array. Here, the UTM projection class member m_zone is assigned a value based on the lat/lon values pulled from the parameter array.
Conclusions • We have developed an object-oriented version of an existing, widely used projection library. • We have made this library much easier to use than the previous version. We have also made it easy to extend. • Currently, the library is still in beta testing. Further testing needs to be done to check projection accuracy. • For further information (download available soon for the latest version), please visit the following website: http://carto-research.er.usgs.gov/
http://carto-research.er.usgs.gov/ An Open-Source, Object-Oriented GCTP Michael S. Williams, Michael P. Finn, and Robert A. Buehler United States Geological Survey National Geospatial Technical Operations Center