Download presentation
Presentation is loading. Please wait.
Published byOctavia Horton Modified over 9 years ago
1
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
2
Outline Motivation Motivation Goals Goals Background Background Design Design Class Structure Class Structure Interface Interface Adding New Projections Adding New Projections Conclusions Conclusions References References
3
Motivation Object-Oriented software development popularity growing Object-Oriented software development popularity growing Many existing libraries written in procedural languages (C, for example) 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) 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 Preferable to have a natively object-oriented library to use
4
Goals (Do’s and Don’ts) Don’t completely reinvent the wheel Don’t completely reinvent the wheel Don’t just make a wrapper Don’t just make a wrapper Do use existing algorithms Do use existing algorithms Do make it simple to use Do make it simple to use Do make it easy to extend Do make it easy to extend
5
Background General Coordinate Transformation Package (GCTP) General Coordinate Transformation Package (GCTP) Originally written in Fortran Originally written in Fortran Later converted to C Later converted to C Still very widely used Still very widely used
6
Background Original GCTP interface very cumbersome. Original GCTP interface very cumbersome.
7
Background Original interface uses 19 parameters! Original interface uses 19 parameters! Calling the gctp function results in much redundant code execution. Calling the gctp function results in much redundant code execution. How can we improve this? How can we improve this?
8
Design
9
Design Simple Design Simple Design Each supported projection contained in a single class. Each supported projection contained in a single class. Each object inherits from the base class “Projection”. Each object inherits from the base class “Projection”. Projection class provides a common interface. Projection class provides a common interface.
10
Design What’s old and what’s new What’s old and what’s new Old Old Still supports the use of the 15 element projection parameter array. Still supports the use of the 15 element projection parameter array. Core projection algorithms exactly the same. Core projection algorithms exactly the same. New New Supports the use of get / set functions to view and modify projection parameters. Supports the use of get / set functions to view and modify projection parameters. No more 19 parameter function calls!! No more 19 parameter function calls!!
11
Design Parameter Array Variable Declarations Object Instantiation Forward Transformation Inverse Transformation Output UnitsDatum
12
Design Setting Parameters
13
Adding New Projections Basic Steps Basic Steps 1.) Derive a new class from “Projection” 1.) Derive a new class from “Projection” 2.) Implement the protected _init(), _forward(), and _inverse() functions. 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. 3.) If the new projection uses specific entries in the parameter array, implement the _loadFromParams() function.
14
Adding New Projections (example) Constructors Core Projection Function Declarations
15
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.
16
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.
17
Conclusions We have developed an object-oriented version of an existing, widely used projection library. 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. 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. 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: For further information (download available soon for the latest version), please visit the following website: http://carto-research.er.usgs.gov/
18
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 http://carto-research.er.usgs.gov/
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.