<?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 Export geometry to file in ArcGIS Enterprise Extensibility Questions</title>
    <link>https://community.esri.com/t5/arcgis-enterprise-extensibility-questions/export-geometry-to-file/m-p/1034415#M245</link>
    <description>&lt;P&gt;Hi, I'm using a SOE and I would like to export a geometry to file in order to share it.&lt;BR /&gt;I tried with ExportToESRIShape (like in&amp;nbsp;&lt;A href="https://enterprise.arcgis.com/en/sdk/latest/windows/webframe.html#IESRIShape.html" target="_self"&gt;this example)&amp;nbsp;&lt;/A&gt;but saving the output buffer in a file I didn't obtain a known format (e.g. shp or zip).&lt;BR /&gt;Anyone knows about another method? or an ExportToESRIShape&amp;nbsp; example to export to file?&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in advance,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Guglielmo.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 09 Mar 2021 13:33:26 GMT</pubDate>
    <dc:creator>Guglielmo_Cordasco</dc:creator>
    <dc:date>2021-03-09T13:33:26Z</dc:date>
    <item>
      <title>Export geometry to file</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-extensibility-questions/export-geometry-to-file/m-p/1034415#M245</link>
      <description>&lt;P&gt;Hi, I'm using a SOE and I would like to export a geometry to file in order to share it.&lt;BR /&gt;I tried with ExportToESRIShape (like in&amp;nbsp;&lt;A href="https://enterprise.arcgis.com/en/sdk/latest/windows/webframe.html#IESRIShape.html" target="_self"&gt;this example)&amp;nbsp;&lt;/A&gt;but saving the output buffer in a file I didn't obtain a known format (e.g. shp or zip).&lt;BR /&gt;Anyone knows about another method? or an ExportToESRIShape&amp;nbsp; example to export to file?&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in advance,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Guglielmo.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Mar 2021 13:33:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-extensibility-questions/export-geometry-to-file/m-p/1034415#M245</guid>
      <dc:creator>Guglielmo_Cordasco</dc:creator>
      <dc:date>2021-03-09T13:33:26Z</dc:date>
    </item>
    <item>
      <title>Re: Export geometry to file</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-extensibility-questions/export-geometry-to-file/m-p/1034417#M246</link>
      <description>&lt;P&gt;First, I don't know what SOE is.&amp;nbsp; But I don't think it matters.&amp;nbsp; I'm responding to make sure you know that an ESRI shapefile is not a SINGLE file.&amp;nbsp; An ESRI Shapefile is a collection of files (minimum 3, maximum like 7).&amp;nbsp; So when you say you didn't get&amp;nbsp; a known format (shp or zip) you won't get a single file.&amp;nbsp; If you export to a shapefile you will get a collection of files with the same root name and each having a different filename extension (ie: .shp, .dbf, .prj, .shx, ...)&lt;/P&gt;</description>
      <pubDate>Tue, 09 Mar 2021 13:41:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-extensibility-questions/export-geometry-to-file/m-p/1034417#M246</guid>
      <dc:creator>AlexRodriguez</dc:creator>
      <dc:date>2021-03-09T13:41:18Z</dc:date>
    </item>
    <item>
      <title>Re: Export geometry to file</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-extensibility-questions/export-geometry-to-file/m-p/1034506#M248</link>
      <description>&lt;P&gt;if can be useful you can see my soe &lt;A href="https://github.com/nicogis/Factory-Utilities-SOE" target="_blank"&gt;https://github.com/nicogis/Factory-Utilities-SOE&lt;/A&gt;&lt;/P&gt;&lt;P&gt;here you have an operation ('&lt;SPAN class="pl-s"&gt;ExtractData&lt;/SPAN&gt;') &lt;A href="https://github.com/nicogis/Factory-Utilities-SOE/blob/37f3a4868d85435bf03cb3b6648a1a7dedccae40/FactoryUtilities.cs#L218" target="_blank"&gt;https://github.com/nicogis/Factory-Utilities-SOE/blob/37f3a4868d85435bf03cb3b6648a1a7dedccae40/FactoryUtilities.cs#L218&lt;/A&gt; where if you can pass a featureset from client you can select parameter &lt;SPAN class="pl-s"&gt;dataFormat&lt;/SPAN&gt; (&lt;SPAN class="pl-en"&gt;SHAPEFILE&lt;/SPAN&gt;) to dowload file zipped&lt;/P&gt;</description>
      <pubDate>Tue, 09 Mar 2021 16:08:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-extensibility-questions/export-geometry-to-file/m-p/1034506#M248</guid>
      <dc:creator>nicogis</dc:creator>
      <dc:date>2021-03-09T16:08:03Z</dc:date>
    </item>
    <item>
      <title>Re: Export geometry to file</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-extensibility-questions/export-geometry-to-file/m-p/1034857#M249</link>
      <description>&lt;P&gt;If you want use sdk you can use FeatureDataConverter class&amp;nbsp; (&amp;nbsp;&lt;A href="https://enterprise.arcgis.com/en/sdk/latest/windows/FeatureDataConverter.html" target="_blank"&gt;FeatureDataConverter Class (arcgis.com)&lt;/A&gt;&amp;nbsp;)&lt;/P&gt;&lt;P&gt;- create a scratch file gdb (try and see if you can use&amp;nbsp;&lt;A href="https://github.com/esri/arcgis-pro-sdk/wiki/ProConcepts-DDL" target="_blank"&gt;ProConcepts DDL · Esri/arcgis-pro-sdk Wiki · GitHub&lt;/A&gt;&amp;nbsp;) or use a template gdb empty on server&lt;/P&gt;&lt;P&gt;- use method convertfeatureclass (&amp;nbsp;&lt;A href="https://developers.arcgis.com/enterprise-sdk/api-reference/net/esriGeoDatabase/IFeatureDataConverter2/#ifeaturedataconverter2convertfeatureclass-method" target="_blank"&gt;IFeatureDataConverter2 Interface | ArcGIS Enterprise SDK&lt;/A&gt;&amp;nbsp;)&lt;/P&gt;&lt;P&gt;- zip gdb&lt;/P&gt;&lt;P&gt;- download file (see this samples&amp;nbsp;&lt;A href="https://github.com/Esri/arcgis-enterprise-sdk-resources/tree/master/Samples/dot%20net/SOE/DownloadFileRESTSOE" target="_blank"&gt;arcgis-enterprise-sdk-resources/Samples/dot net/SOE/DownloadFileRESTSOE at master · Esri/arcgis-enterprise-sdk-resources · GitHub&lt;/A&gt;&amp;nbsp;)&lt;/P&gt;</description>
      <pubDate>Wed, 10 Mar 2021 12:03:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-extensibility-questions/export-geometry-to-file/m-p/1034857#M249</guid>
      <dc:creator>nicogis</dc:creator>
      <dc:date>2021-03-10T12:03:29Z</dc:date>
    </item>
    <item>
      <title>Re: Export geometry to file</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-extensibility-questions/export-geometry-to-file/m-p/1037674#M250</link>
      <description>&lt;P&gt;Thanks nicogis!&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I tried to use your ConvertFeatureClassToShapefile.&lt;BR /&gt;ConvertFeatureClassToShapefile takes as input IWorkspace sourceWorkspace and I have created a sourceWorkspace with:&lt;/P&gt;&lt;P&gt;IMapServer mapServer = (IMapServer)serverObjectHelper.ServerObject;&lt;BR /&gt;string mapName = mapServer.DefaultMapName;&lt;BR /&gt;// Use IMapServerDataAccess to get the data&lt;BR /&gt;IMapServerDataAccess dataAccess = (IMapServerDataAccess)mapServer;&lt;BR /&gt;// Get access to the source feature class.&lt;BR /&gt;IFeatureClass m_fc = (IFeatureClass)dataAccess.GetDataSource(mapName, 0);// Layer 0&lt;BR /&gt;IDataset pDataSet = (IDataset)m_fc;&lt;BR /&gt;IWorkspace sourceWorkspace = pDataSet.Workspace;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;in ConvertFeatureClassToShapefile it is used new FeatureClassNameClass() does not exist in the SDK.&lt;BR /&gt;I replaced it with (IFeatureClassName)pDataSet.FullName but calling (IFeatureClass)sourceName.Open() I get System.Runtime.InteropServices.COMException (0x80040351): Exception from HRESULT: 0x80040351 at ESRI.ArcGIS.esriSystem.IName.Open()&lt;BR /&gt;Where am I doing wrong?&lt;/P&gt;&lt;P&gt;Thanks again.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Mar 2021 16:43:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-extensibility-questions/export-geometry-to-file/m-p/1037674#M250</guid>
      <dc:creator>Guglielmo_Cordasco</dc:creator>
      <dc:date>2021-03-17T16:43:47Z</dc:date>
    </item>
    <item>
      <title>Re: Export geometry to file</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-extensibility-questions/export-geometry-to-file/m-p/1037801#M251</link>
      <description>&lt;P&gt;In help you need see class that implement the interface IFeatureClassName&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="nicogis_0-1616011373470.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/8725iBE68B8557609FEFC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="nicogis_0-1616011373470.png" alt="nicogis_0-1616011373470.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;You can write similar code:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;IMapServer mapServer = (IMapServer)serverObjectHelper.ServerObject;
            string mapName = mapServer.DefaultMapName;
            IMapServerDataAccess dataAccess = (IMapServerDataAccess)mapServer;
            IFeatureClass sourceFeatureClass = (IFeatureClass)dataAccess.GetDataSource(mapName, 0);

            IDataset sourceDataSet = (IDataset)sourceFeatureClass;
            IWorkspace sourceWorkspace = sourceDataSet.Workspace;

            IFeatureDataConverter featureDataConverter = new FeatureDataConverterClass();
            IWorkspaceFactory targetWorkspaceFactory = new ShapefileWorkspaceFactory();
            IWorkspace targetWorkspace = targetWorkspaceFactory.OpenFromFile($@"c:\temp", 0);
            IDataset targetWorkspaceDataset = (IDataset)targetWorkspace;
            IName targetWorkspaceDatasetName = targetWorkspaceDataset.FullName;
            IWorkspaceName targetWorkspaceName = (IWorkspaceName)targetWorkspaceDatasetName;
            IFeatureClassName shpFeatureClassName = new FeatureQueryNameClass();
            IDatasetName shpDatasetName = (IDatasetName)shpFeatureClassName;
            shpDatasetName.WorkspaceName = targetWorkspaceName;
            shpDatasetName.Name = $"Test_{Guid.NewGuid()}";

            int shapeFieldPosition = sourceFeatureClass.FindField(sourceFeatureClass.ShapeFieldName);
            IFields inputFields = sourceFeatureClass.Fields;
            IField shapeField = inputFields.get_Field(shapeFieldPosition);

            IGeometryDef geometryDef = (IGeometryDef)((IClone)shapeField.GeometryDef).Clone();

            IFields outFields = (IFields)((IClone)sourceFeatureClass.Fields).Clone();

            featureDataConverter.ConvertFeatureClass((IFeatureClassName)sourceDataSet.FullName, null, null, shpFeatureClassName, geometryDef, outFields, "", 1000, 0);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Mar 2021 20:03:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-extensibility-questions/export-geometry-to-file/m-p/1037801#M251</guid>
      <dc:creator>nicogis</dc:creator>
      <dc:date>2021-03-17T20:03:27Z</dc:date>
    </item>
  </channel>
</rss>

