<?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 create shapefile from another shapefile in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-create-shapefile-from-another-shapefile/m-p/273030#M6967</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi dubravko.antonic,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;sorry but my english is poor and I don't understand very well&amp;nbsp; what should I do!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Can you post some code, plese?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I create a query tha get lthe list of FID of the row shape that I would like to export to the nwe shape.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Can you suggest me the code that I could use, please?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the prompt response!!!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 12 Aug 2011 12:02:52 GMT</pubDate>
    <dc:creator>FilippaFideria</dc:creator>
    <dc:date>2011-08-12T12:02:52Z</dc:date>
    <item>
      <title>How create shapefile from another shapefile</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-create-shapefile-from-another-shapefile/m-p/273028#M6965</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi forum,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would like to create a tool command to ArcMap 9.3.1 (language C#) that create a new shape file from a list of FID of another shapefile.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Can you suggest me how can I do it, please?&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>Fri, 12 Aug 2011 09:29:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-create-shapefile-from-another-shapefile/m-p/273028#M6965</guid>
      <dc:creator>FilippaFideria</dc:creator>
      <dc:date>2011-08-12T09:29:51Z</dc:date>
    </item>
    <item>
      <title>Re: How create shapefile from another shapefile</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-create-shapefile-from-another-shapefile/m-p/273029#M6966</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Tool expects interaction, input, from user. Command doesn't expect any interaction but does the job.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If you have somewhere predefined FID-s then you create command and do action in the OnClick method.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;get sourceFeature from original FID list.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;in target IFeatureClass.Create - create feature&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;to created feature assign shape from sourceFeature&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;do some attribute update with IFeature.setValue(field index);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if you don't know field index you can use IFeature.Fields.FindField("fieldName") which returns fields index.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;set targetsFeature.SaptialReference = Map.SpatialReference or GeoDataset.SpatialReference&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;save changes to the created feature createdFeature.Store()&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you would like to use undo / redo then You have to inert code from above into try block IEditor.StartOperation and IEditor.StopOperation("operation name tool tip"), and IEditor.AbortOperation int catch block.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;These are some logic steps you should implement. For unknown interfaces use SDK before using to see if there are some examples or description.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Code long and prosper :cool:&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Aug 2011 09:52:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-create-shapefile-from-another-shapefile/m-p/273029#M6966</guid>
      <dc:creator>DubravkoAntonic</dc:creator>
      <dc:date>2011-08-12T09:52:03Z</dc:date>
    </item>
    <item>
      <title>Re: How create shapefile from another shapefile</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-create-shapefile-from-another-shapefile/m-p/273030#M6967</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi dubravko.antonic,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;sorry but my english is poor and I don't understand very well&amp;nbsp; what should I do!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Can you post some code, plese?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I create a query tha get lthe list of FID of the row shape that I would like to export to the nwe shape.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Can you suggest me the code that I could use, please?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the prompt response!!!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Aug 2011 12:02:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-create-shapefile-from-another-shapefile/m-p/273030#M6967</guid>
      <dc:creator>FilippaFideria</dc:creator>
      <dc:date>2011-08-12T12:02:52Z</dc:date>
    </item>
    <item>
      <title>Re: How create shapefile from another shapefile</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-create-shapefile-from-another-shapefile/m-p/273031#M6968</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I think this should work, use some time to get through, it is a must to consult SDK, there are a lot examples that are just waiting to be used.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;IDataset pDataset = destinationFeatureClass as IDataset;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;IEditWorkspace pEditWorkspace = pDataset.Workspace as IEditWorkspace;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;//Open Edit Session&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;try{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pEditWorksapce.StartEditing();&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you got list of FID-s you do as follow:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;// spatialreference&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;IGeoDataset pDestGeoDataset = destinationFeatureClass as IGeoDataset;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;foreach(int fid in FIDlist)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{[INDENT]IFeature pFeature = sourceFeatureClass.GetFeature(fid);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;IFeature pNewFeature = destinationFeatureClass.Create();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pNewFeature.shape = pFeature.ShapeCopy;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pNewFeature.spatialreference = pDestGeoDataset.SpatialReference;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;//set some attribute&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;int fieldIdx = pFeature.Fields.FindField("attributeName");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pNewFeature.SetValue(pFeature.getValue(fieldIdx));&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;pNewFeature.Store();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[/INDENT]}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pEditWorksapce.StopEditing(true);// save edits&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;catch(Exception ex)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[INDENT] //some alert, log ...&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;MessageBox.Show(ex.message);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[/INDENT] }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope it works if not please let me where you got error. Use try/catch&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Aug 2011 12:54:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-create-shapefile-from-another-shapefile/m-p/273031#M6968</guid>
      <dc:creator>DubravkoAntonic</dc:creator>
      <dc:date>2011-08-12T12:54:46Z</dc:date>
    </item>
  </channel>
</rss>

