<?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: Export feature class to CSV with geometry in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/export-feature-class-to-csv-with-geometry/m-p/1298432#M70149</link>
    <description>&lt;P&gt;Thanks&amp;nbsp;@magisan, looks like I will keep using QGIS for this as it takes four clicks to get all of this done&lt;/P&gt;</description>
    <pubDate>Tue, 13 Jun 2023 06:58:53 GMT</pubDate>
    <dc:creator>Moseleyi</dc:creator>
    <dc:date>2023-06-13T06:58:53Z</dc:date>
    <item>
      <title>Export feature class to CSV with geometry</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/export-feature-class-to-csv-with-geometry/m-p/1297888#M70095</link>
      <description>&lt;P&gt;I'm trying to export an Attribute Table to a CSV file where the geometry is in, for example, WKT. I can't find any help regarding this and it's a quite simple task in QGIS via Export feature.&lt;/P&gt;&lt;P&gt;Everything I tried so far exports feature classes to SHP file or attribute table to DBF. I just need simple CSV that includes geometry&lt;/P&gt;</description>
      <pubDate>Sun, 11 Jun 2023 18:38:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/export-feature-class-to-csv-with-geometry/m-p/1297888#M70095</guid>
      <dc:creator>Moseleyi</dc:creator>
      <dc:date>2023-06-11T18:38:11Z</dc:date>
    </item>
    <item>
      <title>Re: Export feature class to CSV with geometry</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/export-feature-class-to-csv-with-geometry/m-p/1297910#M70108</link>
      <description>&lt;P&gt;I don't believe you can add the x/y fields as part of a single processing tool option. There's &lt;A href="https://gis.stackexchange.com/questions/397078/where-are-coordinates-stored-in-arcgis-pro" target="_self"&gt;discussion on this not being possible historically&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;The common method to achieve this is:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Add an x and a y field to the feature class&lt;/LI&gt;&lt;LI&gt;Calculate geometry of your features for each x/y field&lt;/LI&gt;&lt;LI&gt;Export to csv&lt;/LI&gt;&lt;LI&gt;(optional) remove the x/y fields, noting that they need to be recalculated for new features or if your features move&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;You could try using ModelBuilder or the like to build an all in one tool that does this. Maybe have it drop the fields at the end after the export, or do the calculations within the model so as not to modify the original dataset...&amp;nbsp;If this is functionality you'd like, it would make for a great ArcGIS Idea.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jun 2023 01:00:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/export-feature-class-to-csv-with-geometry/m-p/1297910#M70108</guid>
      <dc:creator>ChristopherCounsell</dc:creator>
      <dc:date>2023-06-12T01:00:49Z</dc:date>
    </item>
    <item>
      <title>Re: Export feature class to CSV with geometry</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/export-feature-class-to-csv-with-geometry/m-p/1298432#M70149</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;@magisan, looks like I will keep using QGIS for this as it takes four clicks to get all of this done&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2023 06:58:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/export-feature-class-to-csv-with-geometry/m-p/1298432#M70149</guid>
      <dc:creator>Moseleyi</dc:creator>
      <dc:date>2023-06-13T06:58:53Z</dc:date>
    </item>
    <item>
      <title>Re: Export feature class to CSV with geometry</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/export-feature-class-to-csv-with-geometry/m-p/1304093#M70680</link>
      <description>&lt;P&gt;I'm not super familiar with WKT representations of geometry objects, but would something like this work for you?&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
import csv

# Leave the quotes and the leading "r" in both lines below. Replace my text with your paths.
input_fc = r"THE FULL PATH TO YOUR FEATURE CLASS"
out_csv = r"THE FULL PATH OF A CSV TO BE CREATED"

# Get all the field names. Explicity specify "SHAPE@" for the full geometry object.
fields_curs = ["SHAPE@"] + [f.name for f in arcpy.ListFields(input_fc) if f.type != "Geometry"]

# Create a writeable CSV file. Create the writer object.
with open(out_csv, "w", newline="") as csvfile:
    csvwriter = csv.writer(csvfile, delimiter=",")
    csvwriter.writerow(fields_curs)  # Remove this line if you don't want headers.

    # Write each row in the feature class, including the WKT geometry, to the CSV.
    with arcpy.da.SearchCursor(input_fc, fields_curs) as scurs:
        for geom, *flds in scurs:
            csvwriter.writerow([geom.WKT, *flds])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Assuming you replace the two variables at the top with your actual paths, this should give you an output that contains those geometries as WKT. After updating those variables, you should be able to copy/paste this directly into the Python window within ArcGIS Pro.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="VinceE_0-1687975631153.png" style="width: 757px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/74413i78FCDD162A8C03B0/image-dimensions/757x369?v=v2" width="757" height="369" role="button" title="VinceE_0-1687975631153.png" alt="VinceE_0-1687975631153.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;OID 2 is a multipart polygon. Output:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="VinceE_1-1687975828305.png" style="width: 858px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/74414iEAD6BA36D6490FF2/image-dimensions/858x208?v=v2" width="858" height="208" role="button" title="VinceE_1-1687975828305.png" alt="VinceE_1-1687975828305.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Assuming I have understood what you're after, this would allow you to stay in the Esri environment. But, if all it takes is a couple clicks in QGIS, then that sounds like a pretty good option too.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jun 2023 18:14:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/export-feature-class-to-csv-with-geometry/m-p/1304093#M70680</guid>
      <dc:creator>VinceE</dc:creator>
      <dc:date>2023-06-28T18:14:27Z</dc:date>
    </item>
  </channel>
</rss>

