[Gdal-dev] Double question: Spheres and Ellipsoids, Central Latitude

Bobby Kennedy kennedy at vrco.com
Fri Oct 21 15:49:37 EDT 2005


Hello all,

Two questions, just figured I'd roll it into one email....  The little 
main() below illustrates both questions (I'm using gdal 1.2.3, and proj 
4.4.8).

1) With regards to proj.4 and the projections that only support 
spherical solutions (e.g. Equirectangular), I saw the recent post "eqc 
warping problem" where you mention a possible work around for the z 
changes, do you have plans on implementing that?  Or even better, do you 
know if there are plans to add support for ellipsoids to the these 
projections (it's mentioned on the proj.4 site under 'Future plans', any 
idea of the time frame)?

2) Second question is regarding the code below and the central latitude 
for my equirectangular projection. It doesn't seem to be having any 
effect.  As can be seen in the code, I do a: 
OSRSetEquirectangular(ecWGS84, 30, 110, 0, 0).  When I convert the 
geographic point (110,30,0), I would expect to see a output point of 
(0,0,whatever), but the Y is not 0, instead it appears to the meter 
location of the 30 deg lat.  Is this a fixed bug and I'm just out of 
date, or something else?  Any ideas?

Thanks a lot,

  Bobby


#include "ogr_srs_api.h"
#include <stdio.h>

int main(int argc, char**argv)
{
  // Create a geographic WGS84 srf
  OGRSpatialReferenceH gdWGS84 = OSRNewSpatialReference(NULL);
  OSRSetWellKnownGeogCS(gdWGS84, "WGS84");

  // Create a EC WGS84 srf
  OGRSpatialReferenceH ecWGS84 = OSRNewSpatialReference(NULL);
  OSRSetProjCS( ecWGS84, "EC (WGS84)." );
  OSRSetEquirectangular(ecWGS84, 30, 110, 0, 0);
  OSRSetWellKnownGeogCS(ecWGS84, "WGS84");

  // Create a coordinate transformation form GD to EC
  OGRCoordinateTransformationH gd2ec;
  gd2ec = OCTNewCoordinateTransformation(gdWGS84, ecWGS84);

  // Setup a coord
  double x = 110;
  double y = 30;
  double z = 0.000000;
 
  // Convert form GD to EC
  OCTTransform(gd2ec, 1, &x, &y, &z);

  // Survey says...
  // x = 0.00000000000000000
  // y = 3321065.1468621432    (should be 0???)
  // z = -5312.5797059889883   (Expected b/c EC only supports spherical)

  return 0;
}

-- 
Bobby Kennedy
Software Engineer
VRCO, Inc.
757-456-5500




More information about the Gdal-dev mailing list