<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to create a coordinate system with a user defined datum (i.e. with dx, dy, dz in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-create-a-coordinate-system-with-a-user/m-p/470783#M12757</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: mkennedy&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;STRONG&gt;Hello&lt;/STRONG&gt;,&lt;BR /&gt;&lt;BR /&gt;I'm developing a C# application with an ESRI map engine.&lt;BR /&gt;One of my requirements is to enable the user to define custom Datum with 3 parameters (linear shift) to be used within some Coordinate Systems.&lt;BR /&gt;&lt;BR /&gt;A small sample will be appreciated&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Thanks&lt;/STRONG&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It's a lot easier if you can use existing geographic coordinate systems/datums. Geographic (datum) transformations are maintained separately from the geographic coordinate systems (GCS). A pair of GCS may have many possible&amp;nbsp; transformations based on different areas of interest, accuracies, etc.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm including some C# code that creates a custom 7-parameter transformation. For a 3 parameter, use the GeocentricTranslation class instead. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You will likely also need to cast back to IGeoTransformation.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Melita&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; // Initialize a new spatial reference environment.
&amp;nbsp;&amp;nbsp;&amp;nbsp; // SpatialReferenceEnvironment is a singleton object and needs to use the Activator class.

&amp;nbsp;&amp;nbsp;&amp;nbsp; Type factoryType = Type.GetTypeFromProgID("esriGeometry.SpatialReferenceEnvironment");
&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Object obj = Activator.CreateInstance(factoryType);
&amp;nbsp;&amp;nbsp;&amp;nbsp; ISpatialReferenceFactory2 pSRF = obj as ISpatialReferenceFactory2;

&amp;nbsp;&amp;nbsp;&amp;nbsp; // Initialize and create the input and output coordinate systems.
&amp;nbsp;&amp;nbsp;&amp;nbsp; IProjectedCoordinateSystem2 pPCSin = new ESRI.ArcGIS.Geometry.ProjectedCoordinateSystemClass();
&amp;nbsp;&amp;nbsp;&amp;nbsp; IProjectedCoordinateSystem2 pPCSout = new ESRI.ArcGIS.Geometry.ProjectedCoordinateSystemClass();
&amp;nbsp;&amp;nbsp;&amp;nbsp; pPCSin = (IProjectedCoordinateSystem2)pSRF.CreateProjectedCoordinateSystem((int)esriSRProjCSType.esriSRProjCS_Abidjan1987UTM_30N);
&amp;nbsp;&amp;nbsp;&amp;nbsp; pPCSout = (IProjectedCoordinateSystem2)pSRF.CreateProjectedCoordinateSystem((int)esriSRProjCSType.esriSRProjCS_WGS1984UTM_30N);

&amp;nbsp;&amp;nbsp;&amp;nbsp; IGeographicCoordinateSystem2 pGCSto; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; IGeographicCoordinateSystem2 pGCSfrom;

&amp;nbsp;&amp;nbsp;&amp;nbsp; // Retrieve the geographic coordinate systems from the
&amp;nbsp;&amp;nbsp;&amp;nbsp; // two projected coordinate systems
&amp;nbsp;&amp;nbsp;&amp;nbsp; pGCSfrom = (IGeographicCoordinateSystem2)pPCSin.GeographicCoordinateSystem;
&amp;nbsp;&amp;nbsp;&amp;nbsp; pGCSto = (IGeographicCoordinateSystem2)pPCSout.GeographicCoordinateSystem;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; // Initialize and create an appropriate geographic transformation.
&amp;nbsp;&amp;nbsp;&amp;nbsp; ICoordinateFrameTransformation pCFT;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; pCFT = new CoordinateFrameTransformationClass();
&amp;nbsp;&amp;nbsp;&amp;nbsp; pCFT.PutParameters(1.234, -2.345, 658.3, 4.3829, -2.48591, 2.18943, 2.48585);
&amp;nbsp;&amp;nbsp;&amp;nbsp; pCFT.PutSpatialReferences(pGCSfrom,pGCSto);
&amp;nbsp;&amp;nbsp;&amp;nbsp; pCFT.Name = "Custom GeoTran";
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 20:50:29 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2021-12-11T20:50:29Z</dc:date>
    <item>
      <title>How to create a coordinate system with a user defined datum (i.e. with dx, dy, dz)</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-create-a-coordinate-system-with-a-user/m-p/470782#M12756</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: gershon&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Hello&lt;/STRONG&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm developing a C# application with an ESRI map engine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;One of my requirements is to enable the user to define custom Datum with 3 parameters (linear shift) to be used within some Coordinate Systems.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;A small sample will be appreciated&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Thanks&lt;/STRONG&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Jun 2010 05:45:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-create-a-coordinate-system-with-a-user/m-p/470782#M12756</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2010-06-17T05:45:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a coordinate system with a user defined datum (i.e. with dx, dy, dz</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-create-a-coordinate-system-with-a-user/m-p/470783#M12757</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: mkennedy&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;STRONG&gt;Hello&lt;/STRONG&gt;,&lt;BR /&gt;&lt;BR /&gt;I'm developing a C# application with an ESRI map engine.&lt;BR /&gt;One of my requirements is to enable the user to define custom Datum with 3 parameters (linear shift) to be used within some Coordinate Systems.&lt;BR /&gt;&lt;BR /&gt;A small sample will be appreciated&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Thanks&lt;/STRONG&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It's a lot easier if you can use existing geographic coordinate systems/datums. Geographic (datum) transformations are maintained separately from the geographic coordinate systems (GCS). A pair of GCS may have many possible&amp;nbsp; transformations based on different areas of interest, accuracies, etc.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm including some C# code that creates a custom 7-parameter transformation. For a 3 parameter, use the GeocentricTranslation class instead. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You will likely also need to cast back to IGeoTransformation.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Melita&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; // Initialize a new spatial reference environment.
&amp;nbsp;&amp;nbsp;&amp;nbsp; // SpatialReferenceEnvironment is a singleton object and needs to use the Activator class.

&amp;nbsp;&amp;nbsp;&amp;nbsp; Type factoryType = Type.GetTypeFromProgID("esriGeometry.SpatialReferenceEnvironment");
&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Object obj = Activator.CreateInstance(factoryType);
&amp;nbsp;&amp;nbsp;&amp;nbsp; ISpatialReferenceFactory2 pSRF = obj as ISpatialReferenceFactory2;

&amp;nbsp;&amp;nbsp;&amp;nbsp; // Initialize and create the input and output coordinate systems.
&amp;nbsp;&amp;nbsp;&amp;nbsp; IProjectedCoordinateSystem2 pPCSin = new ESRI.ArcGIS.Geometry.ProjectedCoordinateSystemClass();
&amp;nbsp;&amp;nbsp;&amp;nbsp; IProjectedCoordinateSystem2 pPCSout = new ESRI.ArcGIS.Geometry.ProjectedCoordinateSystemClass();
&amp;nbsp;&amp;nbsp;&amp;nbsp; pPCSin = (IProjectedCoordinateSystem2)pSRF.CreateProjectedCoordinateSystem((int)esriSRProjCSType.esriSRProjCS_Abidjan1987UTM_30N);
&amp;nbsp;&amp;nbsp;&amp;nbsp; pPCSout = (IProjectedCoordinateSystem2)pSRF.CreateProjectedCoordinateSystem((int)esriSRProjCSType.esriSRProjCS_WGS1984UTM_30N);

&amp;nbsp;&amp;nbsp;&amp;nbsp; IGeographicCoordinateSystem2 pGCSto; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; IGeographicCoordinateSystem2 pGCSfrom;

&amp;nbsp;&amp;nbsp;&amp;nbsp; // Retrieve the geographic coordinate systems from the
&amp;nbsp;&amp;nbsp;&amp;nbsp; // two projected coordinate systems
&amp;nbsp;&amp;nbsp;&amp;nbsp; pGCSfrom = (IGeographicCoordinateSystem2)pPCSin.GeographicCoordinateSystem;
&amp;nbsp;&amp;nbsp;&amp;nbsp; pGCSto = (IGeographicCoordinateSystem2)pPCSout.GeographicCoordinateSystem;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; // Initialize and create an appropriate geographic transformation.
&amp;nbsp;&amp;nbsp;&amp;nbsp; ICoordinateFrameTransformation pCFT;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; pCFT = new CoordinateFrameTransformationClass();
&amp;nbsp;&amp;nbsp;&amp;nbsp; pCFT.PutParameters(1.234, -2.345, 658.3, 4.3829, -2.48591, 2.18943, 2.48585);
&amp;nbsp;&amp;nbsp;&amp;nbsp; pCFT.PutSpatialReferences(pGCSfrom,pGCSto);
&amp;nbsp;&amp;nbsp;&amp;nbsp; pCFT.Name = "Custom GeoTran";
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 20:50:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-create-a-coordinate-system-with-a-user/m-p/470783#M12757</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-11T20:50:29Z</dc:date>
    </item>
  </channel>
</rss>

