Issues Creating a Custom Projected Coordinate System

580
4
11-01-2011 02:51 PM
JohnNielson
New Contributor
Hey, Folks:

I'm trying to create a custom coordinate system using NAD27 as my GCS and Albers Equal-Area Conic as my projection.  My program throws an AutomationException with no further info when I try to execute the .define(...) method in the following code block:

ISpatialReferenceFactory spatialReferenceFactory = new SpatialReferenceEnvironment();

ILinearUnit unit = (ILinearUnit) spatialReferenceFactory
  .createUnit(esriSRUnitType.esriSRUnit_Meter);
IGeographicCoordinateSystem gcs = spatialReferenceFactory
  .createGeographicCoordinateSystem(esriSRGeoCSType.esriSRGeoCS_NAD1927);
IProjectionGEN projection = (IProjectionGEN) spatialReferenceFactory
  .createProjection(esriSRProjectionType.esriSRProjection_Albers);
IParameter[] parameters = projection
  .getDefaultParameters();

IProjectedCoordinateSystemEdit pcsEdit = new ProjectedCoordinateSystem();

Object name = "MyProjection";
Object alias = "My Alias";
Object abbreviation = "MP";
Object remarks = "Remarky Mark and the Funky Bunch";
Object usage = "Use this projection when creating an example for the good people of the ArcGIS forums.";
Object gcsObject = gcs;
Object unitObject = unit;
Object projectionObject = projection;
Object parametersObject = parameters;

pcsEdit.define(name, alias, abbreviation, remarks, usage, gcsObject, unitObject, projectionObject, parametersObject);




When writing the above code, I followed this example:

http://edndoc.esri.com/arcobjects/9.2/Java/54ece52a-3a53-11dc-a403-4faa7246d1c1.htm



Again, the AutomationException is thrown when I call pcsEdit.define().


Could anyone please provide guidance?  I'm pretty stumped.



Thanks!


John
0 Kudos
4 Replies
JohnNielson
New Contributor
Update:

I copied and pasted the above example exactly (from the Esri website, linked above) and received the same exception.  Again, this is *the exact same code* as is shown in the example linked above, and I still get the AutomationException when .define(...) is called on the IProjectedCoordinateSystemEdit reference.

Is this a bug?  I'll be contacting our representative shortly to submit a service request.

Needless to say, it's pretty irritating to copy an example from a vendor website and watch it fail.  Does this stuff even get tested?
0 Kudos
PeterHastings
New Contributor
I am having the same issue so this is obviously a bug.

Windows environment using Ganymeade Eclipse and ArcObjects 10.0.
0 Kudos
PeterHastings
New Contributor
0 Kudos