<?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 Custom IDataLayer with relative paths in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/custom-idatalayer-with-relative-paths/m-p/368199#M9690</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm adding relative path support for a custom layer that implements IDataLayer. From what I can tell from the minimal documentation on the subject, this is handled like this:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Serialize the path that gets passed to IDataLayer::put_RelativePath() during serialization (which is typically the directory containing the .mxd-- it's different when saving to .lyr though...).&lt;/LI&gt;&lt;LI&gt;When deserializing the layer, find the current path of the map document containing this layer, and replace the serialized document path with the new one.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's the question: is there any other way to know the location of the map document at the time IPersist::Load() is called other than getting the AppRef? My extension is used in geoprocessing scenarios when there is no AppRef or IMxDocument. Is there any other way, or do I have to manage the map document name myself?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I looked at the FileStream coclass as well. I was thinking the IStream* passed to Load() might have a file reference accessor. It doesn't look like the path is exposed there either. The tagSTATSTG struct returned form IStream::Stat() looked promising, but the &lt;A href="http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.dts.runtime.wrapper.tagstatstg.pwcsname.aspx" style="color: #03697a; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif;"&gt;pwcsName&lt;/A&gt; member was just "Maps". So, no luck there.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The next question would be what if the IDataLayer is in a .lyr file rather than an .mxd? How do I find the path of the .lyr if it is moved?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 14 Oct 2014 15:03:28 GMT</pubDate>
    <dc:creator>KristinBlier</dc:creator>
    <dc:date>2014-10-14T15:03:28Z</dc:date>
    <item>
      <title>Custom IDataLayer with relative paths</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/custom-idatalayer-with-relative-paths/m-p/368199#M9690</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm adding relative path support for a custom layer that implements IDataLayer. From what I can tell from the minimal documentation on the subject, this is handled like this:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Serialize the path that gets passed to IDataLayer::put_RelativePath() during serialization (which is typically the directory containing the .mxd-- it's different when saving to .lyr though...).&lt;/LI&gt;&lt;LI&gt;When deserializing the layer, find the current path of the map document containing this layer, and replace the serialized document path with the new one.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's the question: is there any other way to know the location of the map document at the time IPersist::Load() is called other than getting the AppRef? My extension is used in geoprocessing scenarios when there is no AppRef or IMxDocument. Is there any other way, or do I have to manage the map document name myself?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I looked at the FileStream coclass as well. I was thinking the IStream* passed to Load() might have a file reference accessor. It doesn't look like the path is exposed there either. The tagSTATSTG struct returned form IStream::Stat() looked promising, but the &lt;A href="http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.dts.runtime.wrapper.tagstatstg.pwcsname.aspx" style="color: #03697a; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif;"&gt;pwcsName&lt;/A&gt; member was just "Maps". So, no luck there.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The next question would be what if the IDataLayer is in a .lyr file rather than an .mxd? How do I find the path of the .lyr if it is moved?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Oct 2014 15:03:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/custom-idatalayer-with-relative-paths/m-p/368199#M9690</guid>
      <dc:creator>KristinBlier</dc:creator>
      <dc:date>2014-10-14T15:03:28Z</dc:date>
    </item>
  </channel>
</rss>

