[cig-commits] r20421 - in cs/spatialdata/trunk: . libsrc/geocoords modulesrc/geocoords spatialdata/geocoords tests/libtests/geocoords tests/libtests/geocoords/data tests/pytests/geocoords
brad at geodynamics.org
brad at geodynamics.org
Wed Jun 27 14:10:44 PDT 2012
Author: brad
Date: 2012-06-27 14:10:44 -0700 (Wed, 27 Jun 2012)
New Revision: 20421
Modified:
cs/spatialdata/trunk/CHANGES
cs/spatialdata/trunk/README
cs/spatialdata/trunk/TODO
cs/spatialdata/trunk/configure.ac
cs/spatialdata/trunk/libsrc/geocoords/CSGeoProj.cc
cs/spatialdata/trunk/libsrc/geocoords/CSGeoProj.hh
cs/spatialdata/trunk/libsrc/geocoords/Converter.cc
cs/spatialdata/trunk/modulesrc/geocoords/CSGeoProj.i
cs/spatialdata/trunk/setup.py
cs/spatialdata/trunk/spatialdata/geocoords/CSGeoProj.py
cs/spatialdata/trunk/tests/libtests/geocoords/TestCSGeoProj.cc
cs/spatialdata/trunk/tests/libtests/geocoords/TestCSGeoProj.hh
cs/spatialdata/trunk/tests/libtests/geocoords/data/ConvertDataApp.py
cs/spatialdata/trunk/tests/libtests/geocoords/data/TestCSGeoProj.dat
cs/spatialdata/trunk/tests/libtests/geocoords/data/csgeoproj.odb
cs/spatialdata/trunk/tests/pytests/geocoords/TestCSGeoProj.py
Log:
Added local origin and rotation angle to geographic projected coordinate system.
Modified: cs/spatialdata/trunk/CHANGES
===================================================================
--- cs/spatialdata/trunk/CHANGES 2012-06-27 05:47:47 UTC (rev 20420)
+++ cs/spatialdata/trunk/CHANGES 2012-06-27 21:10:44 UTC (rev 20421)
@@ -1,5 +1,12 @@
-2012/03/23
+2012/06/27 (version 1.9.0) [in progress[
+ Added local origin and rotation angle to projected geographic
+ coordinate system. This provides a local origin to geographic
+ projects that do not necessarily support them in addition to rotated
+ coordinate systems.
+
+2012/03/23 (version 1.8.2)
+
Added ability to use empty ellipsoid and datum in order to use +init option
for Google Earth projections.
Modified: cs/spatialdata/trunk/README
===================================================================
--- cs/spatialdata/trunk/README 2012-06-27 05:47:47 UTC (rev 20420)
+++ cs/spatialdata/trunk/README 2012-06-27 21:10:44 UTC (rev 20421)
@@ -17,12 +17,12 @@
/** @mainpage
*
* @author Brad Aagaard
- * @date 2011/11/09
- * @version 1.8.0
+ * @date 2012/06/01
+ * @version 1.9.0
*
* @section summary Summary
*
- * This directory tree contains SpatialData version 1.8.1. This package
+ * This directory tree contains SpatialData version 1.9.0. This package
* provides an interface to Proj.4 (cartographic projections library)
* for converting coordinates among a variety of geographic projects
* and local Cartesian coordinates and defines an interface for
Modified: cs/spatialdata/trunk/TODO
===================================================================
--- cs/spatialdata/trunk/TODO 2012-06-27 05:47:47 UTC (rev 20420)
+++ cs/spatialdata/trunk/TODO 2012-06-27 21:10:44 UTC (rev 20421)
@@ -1,7 +1,11 @@
GEOCOORDS
- Add local origin and rotation to coordinate systems.
- Local origin should be straightforward.
- Meaning of rotation (orientation) will depend upon coordinate system.
+ Add local origin and rotation to projected coordinate systems.
+ Update libtest.
Make it possible to pickle/unpickle to/from file like in C++?
+
+
+LONG-TERM
+
+ Update Python test scripts.
Modified: cs/spatialdata/trunk/configure.ac
===================================================================
--- cs/spatialdata/trunk/configure.ac 2012-06-27 05:47:47 UTC (rev 20420)
+++ cs/spatialdata/trunk/configure.ac 2012-06-27 21:10:44 UTC (rev 20421)
@@ -15,7 +15,7 @@
#
AC_PREREQ(2.59)
-AC_INIT([spatialdata], [1.8.1], [baagaard at usgs.gov])
+AC_INIT([spatialdata], [1.9.0], [baagaard at usgs.gov])
AC_CONFIG_HEADER([portinfo])
AC_CONFIG_AUX_DIR([./aux-config])
AC_CONFIG_MACRO_DIR([m4])
Modified: cs/spatialdata/trunk/libsrc/geocoords/CSGeoProj.cc
===================================================================
--- cs/spatialdata/trunk/libsrc/geocoords/CSGeoProj.cc 2012-06-27 05:47:47 UTC (rev 20420)
+++ cs/spatialdata/trunk/libsrc/geocoords/CSGeoProj.cc 2012-06-27 21:10:44 UTC (rev 20421)
@@ -19,9 +19,11 @@
#include "CSGeoProj.hh" // implementation of class methods
#include "Projector.hh" // USES Projector
+#include "Converter.hh" // USES Converter
#include "spatialdata/utils/LineParser.hh" // USES LineParser
+#include <math.h> // USES M_PI, sin(), cos()
#include <iostream> // USES std::istream, std::ostream
#include <stdexcept> // USES std::runtime_error, std::exception
@@ -32,6 +34,11 @@
// ----------------------------------------------------------------------
// Default constructor
spatialdata::geocoords::CSGeoProj::CSGeoProj(void) :
+ _originLon(0.0),
+ _originLat(0.0),
+ _originX(0.0),
+ _originY(0.0),
+ _rotAngle(0.0),
_pProjector(0)
{ // constructor
} // constructor
@@ -62,6 +69,61 @@
} // projector
// ----------------------------------------------------------------------
+// Set origin of local projected coordinate system.
+void
+spatialdata::geocoords::CSGeoProj::origin(const double lon,
+ const double lat)
+{ // origin
+ if (lon < -360.0 || lon > 360.0 || lat < -360.0 || lat > 360.0) {
+ std::ostringstream msg;
+ msg << "Longitude (" << lon << ") and latitude (" << lat
+ << ") must be between in the range [-360.0, 360.0].";
+ throw std::runtime_error(msg.str());
+ } // if
+
+ _originLon = lon;
+ _originLat = lat;
+ _originX = 0.0;
+ _originY = 0.0;
+} // origin
+
+// ----------------------------------------------------------------------
+// Get origin of local projected coordinate system.
+void
+spatialdata::geocoords::CSGeoProj::origin(double* pLon,
+ double* pLat)
+{ // origin
+ assert(pLon);
+ assert(pLat);
+
+ *pLon = _originLon;
+ *pLat = _originLat;
+} // origin
+
+// ----------------------------------------------------------------------
+// Set rotation angle (CCW from east) of local x axis.
+void
+spatialdata::geocoords::CSGeoProj::rotationAngle(const double angle)
+{ // rotationAngle
+ if (angle < -360.0 || angle > 360.0) {
+ std::ostringstream msg;
+ msg << "Rotation angle (" << angle
+ << ") must be between in the range [-360.0, 360.0].";
+ throw std::runtime_error(msg.str());
+ } // if
+
+ _rotAngle = angle;
+} // rotationAngle
+
+// ----------------------------------------------------------------------
+// Get rotation angle (CCW from east) of local x axis.
+double
+spatialdata::geocoords::CSGeoProj::rotationAngle(void) const
+{ // rotationAngle
+ return _rotAngle;
+} // rotationAngle
+
+// ----------------------------------------------------------------------
// Initialize the coordinate system.
void
spatialdata::geocoords::CSGeoProj::initialize(void)
@@ -70,6 +132,34 @@
assert(0 != _pProjector);
_pProjector->initialize(*this);
+
+ // Convert origin in lon/lat to projected coordinate system.
+ _originX = 0.0;
+ _originY = 0.0;
+ if (_originLon != 0.0 || _originLat != 0.0) {
+ CSGeo csSrc;
+ csSrc.ellipsoid("WGS84");
+ csSrc.datumHoriz("WGS84");
+ csSrc.datumVert(this->datumVert());
+ csSrc.toMeters(this->toMeters());
+ csSrc.setSpaceDim(2);
+ csSrc.initialize();
+
+ CSGeoProj csDest;
+ csDest.ellipsoid(this->ellipsoid());
+ csDest.datumHoriz(this->datumHoriz());
+ csDest.datumVert(this->datumVert());
+ csDest.toMeters(this->toMeters());
+ csDest.setSpaceDim(2);
+ assert(_pProjector);
+ csDest.projector(*_pProjector);
+ csDest.initialize();
+
+ double originCoords[2] = { _originLon, _originLat };
+ Converter::convert(originCoords, 1, 2, &csDest, &csSrc);
+ _originX = originCoords[0];
+ _originY = originCoords[1];
+ } // if
} // initialize
// ----------------------------------------------------------------------
@@ -91,6 +181,15 @@
throw std::runtime_error(msg.str());
} // if
+ const double angleRad = M_PI * _rotAngle / 180.0;
+ for (int i=0; i < numLocs; ++i) {
+ const double xOld = coords[i*numDims ];
+ const double yOld = coords[i*numDims+1];
+
+ coords[i*numDims ] = _originX + cos(angleRad)*xOld - sin(angleRad)*yOld;
+ coords[i*numDims+1] = _originY + sin(angleRad)*xOld + cos(angleRad)*yOld;
+ } // for
+
_pProjector->invproject(coords, numLocs, numDims);
CSGeo::toProjForm(coords, numLocs, numDims);
} // toProjForm
@@ -116,6 +215,15 @@
CSGeo::fromProjForm(coords, numLocs, numDims);
_pProjector->project(coords, numLocs, numDims);
+
+ const double angleRad = M_PI * _rotAngle / 180.0;
+ for (int i=0; i < numLocs; ++i) {
+ const double xRel = coords[i*numDims ] - _originX;
+ const double yRel = coords[i*numDims+1] - _originY;
+
+ coords[i*numDims ] = cos(angleRad)*xRel + sin(angleRad)*yRel;
+ coords[i*numDims+1] = -sin(angleRad)*xRel + cos(angleRad)*yRel;
+ } // for
} // fromProjForm
// ----------------------------------------------------------------------
@@ -128,6 +236,10 @@
<< " ellipsoid = " << ellipsoid() << "\n"
<< " datum-horiz = " << datumHoriz() << "\n"
<< " datum-vert = " << datumVert() << "\n"
+ << " datum-vert = " << datumVert() << "\n"
+ << " origin-lon = " << _originLon << "\n"
+ << " origin-lat = " << _originLat << "\n"
+ << " rotation-angle = " << rotationAngle() << "\n"
<< " projector = ";
_pProjector->pickle(s);
s << "}\n";
@@ -168,6 +280,12 @@
buffer >> std::ws;
buffer.get(cbuffer, maxIgnore, '\n');
datumVert(cbuffer);
+ } else if (0 == strcasecmp(token.c_str(), "origin-lon")) {
+ buffer >> _originLon;
+ } else if (0 == strcasecmp(token.c_str(), "origin-lat")) {
+ buffer >> _originLat;
+ } else if (0 == strcasecmp(token.c_str(), "rotation-angle")) {
+ buffer >> _rotAngle;
} else if (0 == strcasecmp(token.c_str(), "projector")) {
std::string rbuffer(buffer.str());
int start = token.length();
Modified: cs/spatialdata/trunk/libsrc/geocoords/CSGeoProj.hh
===================================================================
--- cs/spatialdata/trunk/libsrc/geocoords/CSGeoProj.hh 2012-06-27 05:47:47 UTC (rev 20420)
+++ cs/spatialdata/trunk/libsrc/geocoords/CSGeoProj.hh 2012-06-27 21:10:44 UTC (rev 20421)
@@ -49,15 +49,43 @@
*/
virtual CoordSys* clone(void) const;
- /// Initialize the coordinate system.
- void initialize(void);
-
/** Set projector.
*
* @param projector Geographic coordinate projector
*/
void projector(const Projector& projector);
+ /** Set origin of local projected coordinate system.
+ *
+ * @param lon Longitude of origin (degrees)
+ * @param lat Latitude of origin (degrees)
+ */
+ void origin(const double lon,
+ const double lat);
+
+ /** Get origin of local projected coordinate system.
+ *
+ * @param pLon Pointer to longitude of origin (degrees)
+ * @param pLat Pointer to latitude of origin (degrees)
+ */
+ void origin(double* pLon,
+ double* pLat);
+
+ /** Set rotation angle (CCW from east) of local x axis.
+ *
+ * @param angle Rotation angle.
+ */
+ void rotationAngle(const double angle);
+
+ /** Get rotation angle (CCW from east) of local x axis.
+ *
+ * @returns Rotation angle.
+ */
+ double rotationAngle(void) const;
+
+ /// Initialize the coordinate system.
+ void initialize(void);
+
/** Convert coordinates to PROJ4 useable form.
*
* @param coords Array of coordinates [numLocs*numDims]
@@ -102,6 +130,12 @@
private :
// PRIVATE MEMBERS ////////////////////////////////////////////////////
+ double _originLon;
+ double _originLat;
+ double _originX;
+ double _originY;
+ double _rotAngle;
+
Projector* _pProjector; ///< Pointer to Projector
}; // class CSGeoProj
Modified: cs/spatialdata/trunk/libsrc/geocoords/Converter.cc
===================================================================
--- cs/spatialdata/trunk/libsrc/geocoords/Converter.cc 2012-06-27 05:47:47 UTC (rev 20420)
+++ cs/spatialdata/trunk/libsrc/geocoords/Converter.cc 2012-06-27 21:10:44 UTC (rev 20421)
@@ -162,7 +162,7 @@
const int pjerrno =
pj_transform(csSrc->projCoordSys(), csDest->projCoordSys(),
numLocs, numDims, pX, pY, pZ);
- if (0 != pjerrno) {
+ if (pjerrno) {
std::ostringstream msg;
msg << "Error while converting coordinates:\n"
<< " " << pj_strerrno(pjerrno) << "\n";
Modified: cs/spatialdata/trunk/modulesrc/geocoords/CSGeoProj.i
===================================================================
--- cs/spatialdata/trunk/modulesrc/geocoords/CSGeoProj.i 2012-06-27 05:47:47 UTC (rev 20420)
+++ cs/spatialdata/trunk/modulesrc/geocoords/CSGeoProj.i 2012-06-27 21:10:44 UTC (rev 20421)
@@ -42,15 +42,44 @@
virtual
CoordSys* clone(void) const;
- /// Initialize the coordinate system.
- void initialize(void);
-
/** Set projector.
*
* @param projector Geographic coordinate projector
*/
void projector(const Projector& projector);
+ /** Set origin of local projected coordinate system.
+ *
+ * @param lon Longitude of origin (degrees)
+ * @param lat Latitude of origin (degrees)
+ */
+ void origin(const double lon,
+ const double lat);
+
+ /** Get origin of local projected coordinate system.
+ *
+ * @param pLon Pointer to longitude of origin (degrees)
+ * @param pLat Pointer to latitude of origin (degrees)
+ */
+ %apply double* OUTPUT { double* pLon, double* pLat };
+ void origin(double* pLon,
+ double* pLat);
+
+ /** Set rotation angle (CCW from east) of local x axis.
+ *
+ * @param angle Rotation angle.
+ */
+ void rotationAngle(const double angle);
+
+ /** Get rotation angle (CCW from east) of local x axis.
+ *
+ * @returns Rotation angle.
+ */
+ double rotationAngle(void) const;
+
+ /// Initialize the coordinate system.
+ void initialize(void);
+
}; // class CSGeoProj
} // geocoords
Modified: cs/spatialdata/trunk/setup.py
===================================================================
--- cs/spatialdata/trunk/setup.py 2012-06-27 05:47:47 UTC (rev 20420)
+++ cs/spatialdata/trunk/setup.py 2012-06-27 21:10:44 UTC (rev 20421)
@@ -20,7 +20,7 @@
setup(
name = 'spatialdata',
- version = '1.8.1',
+ version = '1.9.0',
zip_safe = False,
packages = find_packages(),
Modified: cs/spatialdata/trunk/spatialdata/geocoords/CSGeoProj.py
===================================================================
--- cs/spatialdata/trunk/spatialdata/geocoords/CSGeoProj.py 2012-06-27 05:47:47 UTC (rev 20420)
+++ cs/spatialdata/trunk/spatialdata/geocoords/CSGeoProj.py 2012-06-27 21:10:44 UTC (rev 20421)
@@ -42,13 +42,24 @@
## Python object for managing CSGeoProj facilities and properties.
##
## \b Properties
- ## @li None
+ ## @li origin_lon Longitude of local origin in degrees.
+ ## @li origin_lat Latitude of local origin in degrees.
+ ## @li rotation_angle Rotation angle (CCW) of local x-axis from east.
##
## \b Facilities
## @li \b projector Geographic coordinate projector
import pyre.inventory
+ originLon = pyre.inventory.float("origin_lon", default=0.0)
+ originLon.meta['tip'] = "Longitude of local origin in degrees."
+
+ originLat = pyre.inventory.float("origin_lat", default=0.0)
+ originLat.meta['tip'] = "Latitude of local origin in degrees."
+
+ rotAngle = pyre.inventory.float("rotation_angle", default=0.0)
+ rotAngle.meta['tip'] = "Rotation angle (CCW) of local x-axis from east."
+
from Projector import Projector
projector = pyre.inventory.facility("projector", family="projector",
factory=Projector)
@@ -72,7 +83,11 @@
Setup members using inventory.
"""
CSGeo._configure(self)
- self.projector(self.inventory.projector)
+ ModuleCSGeoProj.origin(self,
+ self.inventory.originLon,
+ self.inventory.originLat)
+ ModuleCSGeoProj.rotationAngle(self, self.inventory.rotAngle)
+ ModuleCSGeoProj.projector(self, self.inventory.projector)
return
Modified: cs/spatialdata/trunk/tests/libtests/geocoords/TestCSGeoProj.cc
===================================================================
--- cs/spatialdata/trunk/tests/libtests/geocoords/TestCSGeoProj.cc 2012-06-27 05:47:47 UTC (rev 20420)
+++ cs/spatialdata/trunk/tests/libtests/geocoords/TestCSGeoProj.cc 2012-06-27 21:10:44 UTC (rev 20421)
@@ -163,6 +163,9 @@
CPPUNIT_ASSERT(0 == strcasecmp(_ELLIPSOID, csB.ellipsoid()));
CPPUNIT_ASSERT(0 == strcasecmp(_DATUMHORIZ, csB.datumHoriz()));
CPPUNIT_ASSERT(0 == strcasecmp(_DATUMVERT, csB.datumVert()));
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(_ORIGINLON, csB._originLon, tolerance);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(_ORIGINLAT, csB._originLat, tolerance);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(_ROTANGLE, csB.rotationAngle(), tolerance);
} // testPickle
Modified: cs/spatialdata/trunk/tests/libtests/geocoords/TestCSGeoProj.hh
===================================================================
--- cs/spatialdata/trunk/tests/libtests/geocoords/TestCSGeoProj.hh 2012-06-27 05:47:47 UTC (rev 20420)
+++ cs/spatialdata/trunk/tests/libtests/geocoords/TestCSGeoProj.hh 2012-06-27 21:10:44 UTC (rev 20421)
@@ -70,6 +70,10 @@
static const char* _ELLIPSOID; ///< Name of reference ellipsoid
static const char* _DATUMHORIZ; ///< Name of horizontal datum
static const char* _DATUMVERT; ///< Name of vertical datum
+ static const double _ORIGINLON; ///< Longitude of local origin
+ static const double _ORIGINLAT; ///< Latitude of local origin
+ static const double _ROTANGLE; ///< Rotangle angle of local coordinate system
+
static const char* _PROJECTION; ///< Name of projection
static const char* _UNITS; ///< Units in projection
static const char* _PROJOPTIONS; ///< Options for projection
Modified: cs/spatialdata/trunk/tests/libtests/geocoords/data/ConvertDataApp.py
===================================================================
--- cs/spatialdata/trunk/tests/libtests/geocoords/data/ConvertDataApp.py 2012-06-27 05:47:47 UTC (rev 20420)
+++ cs/spatialdata/trunk/tests/libtests/geocoords/data/ConvertDataApp.py 2012-06-27 21:10:44 UTC (rev 20421)
@@ -47,17 +47,14 @@
## @li \b dumper Dump data to file
import pyre.inventory
- from pythiautil.DumpCpp import DumpCpp
+ from spatialdata.utils.CppData import CppData
from ConvertData import ConvertData
data = pyre.inventory.facility('data', factory=ConvertData)
- dumper = pyre.inventory.facility('dumper', factory=DumpCpp)
+ dumper = pyre.inventory.facility('dumper', factory=CppData)
# main
if __name__ == '__main__':
app = ConvertDataApp()
app.run()
-# version
-__id__ = "$Id: ConvertDataApp.py,v 1.1 2005/05/25 17:30:21 baagaard Exp $"
-
# End of file
Modified: cs/spatialdata/trunk/tests/libtests/geocoords/data/TestCSGeoProj.dat
===================================================================
--- cs/spatialdata/trunk/tests/libtests/geocoords/data/TestCSGeoProj.dat 2012-06-27 05:47:47 UTC (rev 20420)
+++ cs/spatialdata/trunk/tests/libtests/geocoords/data/TestCSGeoProj.dat 2012-06-27 21:10:44 UTC (rev 20421)
@@ -20,6 +20,12 @@
const char* spatialdata::geocoords::TestCSGeoProj::_ELLIPSOID = "clrk66";
const char* spatialdata::geocoords::TestCSGeoProj::_DATUMHORIZ = "NAD27";
const char* spatialdata::geocoords::TestCSGeoProj::_DATUMVERT = "mean sea level";
+const double spatialdata::geocoords::TestCSGeoProj::_ORIGINLON = 0.000000000000e+00;
+
+const double spatialdata::geocoords::TestCSGeoProj::_ORIGINLAT = 0.000000000000e+00;
+
+const double spatialdata::geocoords::TestCSGeoProj::_ROTANGLE = 0.000000000000e+00;
+
const char* spatialdata::geocoords::TestCSGeoProj::_PROJECTION = "tmerc";
const char* spatialdata::geocoords::TestCSGeoProj::_UNITS = "km";
const char* spatialdata::geocoords::TestCSGeoProj::_PROJOPTIONS = "+lon_0=-100.0 +lat_0=30.0 +k=0.9996";
Modified: cs/spatialdata/trunk/tests/libtests/geocoords/data/csgeoproj.odb
===================================================================
--- cs/spatialdata/trunk/tests/libtests/geocoords/data/csgeoproj.odb 2012-06-27 05:47:47 UTC (rev 20420)
+++ cs/spatialdata/trunk/tests/libtests/geocoords/data/csgeoproj.odb 2012-06-27 21:10:44 UTC (rev 20421)
@@ -16,8 +16,6 @@
## @file geocoords/tests/libtests/data/csgeoproj.odb
## @brief Python data generator for csgeoproj tests.
-from Numeric import ravel
-
def data():
"""Factory method for facility data."""
return CSGeoProj()
@@ -35,9 +33,13 @@
self.ellipsoid = "clrk66"
self.datumHoriz = "NAD27"
self.datumVert = "mean sea level"
+ self.originLon = -100.0
+ self.originLat = 30.0
+ self.rotAngle = 0.0
self.projection = "tmerc"
self.units = "km"
- self.projOptions = "+lon_0=-100.0 +lat_0=30.0 +k=0.9996"
+ self.projOptions = "+lon_0=%f +lat_0=%f +k=0.9996" % \
+ (self.originLon, self.originLat)
self._command = "proj +proj=%s +datum=%s +ellps=%s " \
"%s " \
"+units=%s -f %s" % \
@@ -56,18 +58,21 @@
def dump(self, dumper):
"""Dump data."""
- dumper.open(self.name)
- dumper.writeVal("char*", "_ELLIPSOID", self.ellipsoid, "\"%s\"")
- dumper.writeVal("char*", "_DATUMHORIZ", self.datumHoriz, "\"%s\"")
- dumper.writeVal("char*", "_DATUMVERT", self.datumVert, "\"%s\"")
- dumper.writeVal("char*", "_PROJECTION", self.projection, "\"%s\"")
- dumper.writeVal("char*", "_UNITS", self.units, "\"%s\"")
- dumper.writeVal("char*", "_PROJOPTIONS", self.projOptions, "\"%s\"")
- dumper.writeVal("int", "_NUMLOCS", len(self.lonlatelev), "%d")
- dumper.writeArray("double", "_LONLATNAD27ELEV", ravel(self.lonlatelev),
- "%20.12e,", 3)
- dumper.writeArray("double", "_XYZ", ravel(self.xyz), "%20.12e,", 3)
- dumper.close()
+ dumper.addScalar("char*", "_ELLIPSOID", self.ellipsoid, "\"%s\"")
+ dumper.addScalar("char*", "_DATUMHORIZ", self.datumHoriz, "\"%s\"")
+ dumper.addScalar("char*", "_DATUMVERT", self.datumVert, "\"%s\"")
+ dumper.addScalar("char*", "_PROJECTION", self.projection, "\"%s\"")
+ dumper.addScalar("double", "_ORIGINLON", self.originLon, "%20.12e")
+ dumper.addScalar("double", "_ORIGINLAT", self.originLat, "%20.12e")
+ dumper.addScalar("double", "_ROTANGLE", self.rotAngle, "%20.12e")
+ dumper.addScalar("char*", "_UNITS", self.units, "\"%s\"")
+ dumper.addScalar("char*", "_PROJOPTIONS", self.projOptions, "\"%s\"")
+ dumper.addScalar("int", "_NUMLOCS", len(self.lonlatelev), "%d")
+ dumper.addArray("double", "_LONLATNAD27ELEV", self.lonlatelev,
+ "%20.12e", 3)
+ dumper.addArray("double", "_XYZ", self.xyz, "%20.12e", 3)
+
+ dumper.write(self.name)
return
@@ -78,7 +83,5 @@
self._fileDest = "dest.dat"
return
-# version
-__id__ = "$Id: projector.odb,v 1.1 2005/05/25 17:30:21 baagaard Exp $"
# End of file
Modified: cs/spatialdata/trunk/tests/pytests/geocoords/TestCSGeoProj.py
===================================================================
--- cs/spatialdata/trunk/tests/pytests/geocoords/TestCSGeoProj.py 2012-06-27 05:47:47 UTC (rev 20420)
+++ cs/spatialdata/trunk/tests/pytests/geocoords/TestCSGeoProj.py 2012-06-27 21:10:44 UTC (rev 20421)
@@ -31,6 +31,9 @@
cs.inventory.ellipsoid = "clrk66"
cs.inventory.datumHoriz = "NAD27"
cs.inventory.datumVert = "mean sea level"
+ cs.inventory.originLon = 105.0
+ cs.inventory.originLat = 30.0
+ cs.inventory.rotAngle = 0.0
cs.inventory.units = "km"
cs.inventory.spaceDim = 2
cs.inventory.projector = proj
More information about the CIG-COMMITS
mailing list