I'm having some trouble connecting ideas on how to solve a problem. What I have is a shapefile from which I have to extract from one field, which contains 3 types of attributes (BS, RS, BRN). For each of those attributes, I've created a geodatabase and separate feature classes using another script.
I short, attributes have to go to their specific designation e.g. BS values go to feature BS, RS values etc.
My first guess is that I have to use Cursors to do it, but in this case I have to use both Search and Insert and how would I do that?
Would it make sense a start such as this?
import arcpy
shape = "D:/M1 Geomatique/Programmation II/Dossier/ZONE_INONDATION_SYNTHESE_67.shp"
gdb = "D:/M1 Geomatique/Programmation II/Dossier/inondation.gdb"
field = "CODE_DEGRE"
entite1 = "rs"
entite2 = "bs"
entite3 = "brn"
rows = arcpy.InsertCursor(gdb)
cursor = arcpy.SearchCursor(shape)
Perform a loop start with a SearchCursor followed by an InsertCursor could be a solution ? :
e.g.
<SPAN class="kwd">with</SPAN><SPAN class="pln"> arcpy</SPAN><SPAN class="pun">.</SPAN><SPAN class="pln">da</SPAN><SPAN class="pun">.</SPAN><SPAN class="typ">SearchCursor</SPAN><SPAN class="pun">(</SPAN><SPAN class="pln">sourceFC</SPAN><SPAN class="pun">,</SPAN><SPAN class="pln">fieldnames</SPAN><SPAN class="pun">)</SPAN><SPAN class="pln"> </SPAN><SPAN class="kwd">as</SPAN><SPAN class="pln"> sCur</SPAN><SPAN class="pun">:</SPAN><SPAN class="pln">
</SPAN><SPAN class="kwd"> with</SPAN><SPAN class="pln"> arcpy</SPAN><SPAN class="pun">.</SPAN><SPAN class="pln">da</SPAN><SPAN class="pun">.</SPAN><SPAN class="typ">InsertCursor</SPAN><SPAN class="pun">(</SPAN><SPAN class="pln">targetFC</SPAN><SPAN class="pun">,</SPAN><SPAN class="pln">fieldnames</SPAN><SPAN class="pun">)</SPAN><SPAN class="pln"> </SPAN><SPAN class="kwd">as</SPAN><SPAN class="pln"> iCur</SPAN><SPAN class="pun">:</SPAN>
Above is just an example I've picked up on stackexchange
How would you advise me to tackle this problem?