Hi Guys,
I need a script which would write the name and geometry (Point,Line,Polygon) of the Feature Classes from an Ent. GDB to a CSV file.
So far, I am able to write the names successfully using the below script.
<SPAN class="keyword token">import</SPAN> arcpy
<SPAN class="keyword token">from</SPAN> arcpy <SPAN class="keyword token">import</SPAN> env
<SPAN class="keyword token">import</SPAN> os
<SPAN class="comment token"># Set the workspace for the ListFeatureClass function </SPAN>
<SPAN class="keyword token">from</SPAN> arcpy <SPAN class="keyword token">import</SPAN> env
<SPAN class="keyword token">import</SPAN> os
<SPAN class="comment token"># Set the workspace for the ListFeatureClass function </SPAN>
env<SPAN class="punctuation token">.</SPAN>workspace <SPAN class="operator token">=</SPAN> r<SPAN class="string token">"Path\xyz.sde"</SPAN>
<SPAN class="comment token"># Use the ListFeatureClasses function to return a list of all fc's in the sde gdb: </SPAN>
fcList <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>ListFeatureClasses<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token"># Write the name of the current fc in csv file:</SPAN>
txtFile <SPAN class="operator token">=</SPAN> open<SPAN class="punctuation token">(</SPAN>r<SPAN class="string token">"Path\xyz.csv"</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">"w"</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">for</SPAN> fc <SPAN class="keyword token">in</SPAN> fcList<SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">print</SPAN> fc
<SPAN class="comment token"># Write messages to a csv File</SPAN>
txtFile<SPAN class="punctuation token">.</SPAN>write<SPAN class="punctuation token">(</SPAN>fc<SPAN class="punctuation token">)</SPAN>
txtFile<SPAN class="punctuation token">.</SPAN>write <SPAN class="punctuation token">(</SPAN>os<SPAN class="punctuation token">.</SPAN>linesep<SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token">#close csv file</SPAN>
txtFile<SPAN class="punctuation token">.</SPAN>close<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">print</SPAN> <SPAN class="string token">"done"</SPAN>
<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
How do I write the Geometry Type?
Also suggestions are welcome to further optimize the above script.
Thanks!!!