<?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: Set Spatial Reference for a a XY event source layer in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/set-spatial-reference-for-a-a-xy-event-source/m-p/361265#M9520</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I would imagine that you will have to set it on the layer itself using IFeatureLayer.SpatialReference.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 28 May 2014 12:15:32 GMT</pubDate>
    <dc:creator>NeilClemmons</dc:creator>
    <dc:date>2014-05-28T12:15:32Z</dc:date>
    <item>
      <title>Set Spatial Reference for a a XY event source layer</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/set-spatial-reference-for-a-a-xy-event-source/m-p/361264#M9519</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have an XY event source layer, added to ArcMap with the option &lt;/SPAN&gt;&lt;STRONG&gt;File &amp;gt; Add Data &amp;gt; Add XY Data&lt;/STRONG&gt;&lt;SPAN&gt;, but when trying to change the spatial reference of this layer with ArcObjects I get a E_NOINTERFACE error.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The code snippet that manages the change of the spatial reference is like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Dim spatialRef As ISpatialReference = ...
Dim geoDataset As IGeoDataset = fl.FeatureClass

Dim geoDatasetSchemaEdit As IGeoDatasetSchemaEdit = geoDataset
If (geoDatasetSchemaEdit.CanAlterSpatialReference) Then
 geoDatasetSchemaEdit.AlterSpatialReference(spatialRef)
End If&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Previous code works fine for other type of layers. Also from the ArcMap UI is possible to change the spatial reference of an XY event source layer, so I guess should be possible with ArcObjects.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I found these related posts: &lt;/SPAN&gt;&lt;A href="http://forums.arcgis.com/threads/74625-casting-igeodataset-to-igeodatasetschemaedit-gives-e_nointerface-error" rel="nofollow noopener noreferrer" target="_blank"&gt;http://forums.arcgis.com/threads/74625-casting-igeodataset-to-igeodatasetschemaedit-gives-e_nointerface-error&lt;/A&gt;&lt;SPAN&gt; and &lt;/SPAN&gt;&lt;A href="http://forums.arcgis.com/threads/7607-Is-it-possible-to-change-spatialreference-by-arcobjects?highlight=change+feature+class+spatial+reference" rel="nofollow noopener noreferrer" target="_blank"&gt;http://forums.arcgis.com/threads/7607-Is-it-possible-to-change-spatialreference-by-arcobjects?highlight=change+feature+class+spatial+reference&lt;/A&gt;&lt;SPAN&gt;, but didn't succeed.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any idea how can be change the spatial reference of XY event source layers with ArcObjects? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in advance.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:51:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/set-spatial-reference-for-a-a-xy-event-source/m-p/361264#M9519</guid>
      <dc:creator>JoseGarcia</dc:creator>
      <dc:date>2021-12-11T16:51:23Z</dc:date>
    </item>
    <item>
      <title>Re: Set Spatial Reference for a a XY event source layer</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/set-spatial-reference-for-a-a-xy-event-source/m-p/361265#M9520</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I would imagine that you will have to set it on the layer itself using IFeatureLayer.SpatialReference.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 May 2014 12:15:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/set-spatial-reference-for-a-a-xy-event-source/m-p/361265#M9520</guid>
      <dc:creator>NeilClemmons</dc:creator>
      <dc:date>2014-05-28T12:15:32Z</dc:date>
    </item>
  </channel>
</rss>

