<?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: Format WKT to nearest meter in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/format-wkt-to-nearest-meter/m-p/535821#M41975</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Haha, Thank you very much, mister &lt;A href="https://community.esri.com/migrated-users/3100"&gt;Xander Bakker&lt;/A&gt;​, that is the kind of "slide-of-hand-arcgis-trick" I was looking for. Nicely done, I'll go with that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By the way, dropping the 11 digits after the decimal place of each coordinate reduced the size of the output text file from about 150 MB to about 50 MB!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To clarify the coordinate system, this was in British National Grid (&lt;A href="http://epsg.io/27700.esriwkt"&gt;EPSG:27700&lt;/A&gt;), i.e. projected in metres.&lt;/P&gt;&lt;P&gt;Thanks everyone, &lt;/P&gt;&lt;P&gt;Filip.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 19 Jan 2016 09:28:04 GMT</pubDate>
    <dc:creator>FilipKrál</dc:creator>
    <dc:date>2016-01-19T09:28:04Z</dc:date>
    <item>
      <title>Format WKT to nearest meter</title>
      <link>https://community.esri.com/t5/python-questions/format-wkt-to-nearest-meter/m-p/535817#M41971</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a polygon feature class and I want to produce a text file where each feature is a row with an ID and the polygon geometry formatted as Well Known Text (WKT).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To start with I am looping though the features and I use the .WKT property to produce the result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My problem is that the WKT is often formatted with coordinates reported to 12 decimal places. I need to round the coordinates to the nearest meter. Ideally I want to be able to do this with other types of geometries so I'd prefer something else then looping over the rings and vertices.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way to do this? I tried to set arcpy.env.XYTolerance and arcpy.env.XYResolution to 1.0 but that had no effect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any hints?&lt;/P&gt;&lt;P&gt;Filip.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Jan 2016 15:29:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/format-wkt-to-nearest-meter/m-p/535817#M41971</guid>
      <dc:creator>FilipKrál</dc:creator>
      <dc:date>2016-01-18T15:29:57Z</dc:date>
    </item>
    <item>
      <title>Re: Format WKT to nearest meter</title>
      <link>https://community.esri.com/t5/python-questions/format-wkt-to-nearest-meter/m-p/535818#M41972</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are they projected coordinates or geographic? since chopping off decimal points in geographic coordinates isn't going to get you to your desired meter cutoff since the decimal places are a function of position&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Jan 2016 16:24:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/format-wkt-to-nearest-meter/m-p/535818#M41972</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-01-18T16:24:15Z</dc:date>
    </item>
    <item>
      <title>Re: Format WKT to nearest meter</title>
      <link>https://community.esri.com/t5/python-questions/format-wkt-to-nearest-meter/m-p/535819#M41973</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would take a look at &lt;A href="http://support.esri.com/en/knowledgebase/techarticles/detail/45376" title="http://support.esri.com/en/knowledgebase/techarticles/detail/45376"&gt;45376 - Export coordinates of polygon vertices to a TXT file&lt;/A&gt;&amp;nbsp;&amp;nbsp; just add two new fields with the field precision set to what you want, and do a simple calculation? Do this before you export your file using those fields.&amp;nbsp; Sometimes simple is best (unless you are doing it multiple times, in which case a python script would help), &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if if you are needing the cordinates in a different corrdinate system than they are currently, there are several ways to get those coordinates one you have your polygon converted to points, including &lt;A href="http://resources.arcgis.com/en/help/main/10.2/0017/0017000000tw000000.htm" title="http://resources.arcgis.com/en/help/main/10.2/0017/0017000000tw000000.htm"&gt;ArcGIS Help 10.2 - Convert Coordinate Notation (Data Management)&lt;/A&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;or for 10.3&amp;nbsp;&amp;nbsp; &lt;A href="http://desktop.arcgis.com/en/desktop/latest/tools/data-management-toolbox/convert-coordinate-notation.htm" title="http://desktop.arcgis.com/en/desktop/latest/tools/data-management-toolbox/convert-coordinate-notation.htm"&gt;Convert Coordinate Notation—Help | ArcGIS for Desktop&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Jan 2016 16:50:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/format-wkt-to-nearest-meter/m-p/535819#M41973</guid>
      <dc:creator>RebeccaStrauch__GISP</dc:creator>
      <dc:date>2016-01-18T16:50:08Z</dc:date>
    </item>
    <item>
      <title>Re: Format WKT to nearest meter</title>
      <link>https://community.esri.com/t5/python-questions/format-wkt-to-nearest-meter/m-p/535820#M41974</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There is a way... if you make a copy of the data using the settings you alread tried.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
fc = r"D:\Xander\EPM\Datos pruebas\gdb\datos erase.gdb\line_copy_proj"
fc_tmp = r"IN_MEMORY\test"

arcpy.env.XYResolution = 1
arcpy.env.XYTolerance = 1
arcpy.CopyFeatures_management(fc, fc_tmp)

flds = ('SHAPE@WKT')
with arcpy.da.SearchCursor(fc_tmp, flds) as cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print row[0]&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;original output:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;MULTILINESTRING ((836240.86539999954 1179632.7086999994, 837135.58619999979 1181670.2111000009, 839675.22300000023 1183242.5173000004, 839712.04700000025 1184657.2405999992, 839258.58920000028 1187356.5383000001, 839133.95399999991 1189890.4180999994))&lt;/P&gt;&lt;P&gt;MULTILINESTRING ((833475.98560000025 1180002.4503000006, 834079.72329999972 1183883.3637000006, 834317.80570000038 1186547.8800000008, 835274.46169999987 1187203.2232000008, 837515.99909999967 1188183.9852000009))&lt;/P&gt;&lt;P&gt;MULTILINESTRING ((837624.12339999992 1191506.9096000008, 834850.68890000042 1188685.0925999992, 833435.97180000041 1189018.1926000006, 833605.04540000018 1190564.1831999999))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;after making the copy in memory:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;MULTILINESTRING ((836241 1179633, 837136 1181670, 839675 1183243, 839712 1184657, 839259 1187357, 839134 1189890))&lt;/P&gt;&lt;P&gt;MULTILINESTRING ((833476 1180002, 834080 1183883, 834318 1186548, 835274 1187203, 837516 1188184))&lt;/P&gt;&lt;P&gt;MULTILINESTRING ((837624 1191507, 834851 1188685, 833436 1189018, 833605 1190564))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 23:16:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/format-wkt-to-nearest-meter/m-p/535820#M41974</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-11T23:16:33Z</dc:date>
    </item>
    <item>
      <title>Re: Format WKT to nearest meter</title>
      <link>https://community.esri.com/t5/python-questions/format-wkt-to-nearest-meter/m-p/535821#M41975</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Haha, Thank you very much, mister &lt;A href="https://community.esri.com/migrated-users/3100"&gt;Xander Bakker&lt;/A&gt;​, that is the kind of "slide-of-hand-arcgis-trick" I was looking for. Nicely done, I'll go with that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By the way, dropping the 11 digits after the decimal place of each coordinate reduced the size of the output text file from about 150 MB to about 50 MB!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To clarify the coordinate system, this was in British National Grid (&lt;A href="http://epsg.io/27700.esriwkt"&gt;EPSG:27700&lt;/A&gt;), i.e. projected in metres.&lt;/P&gt;&lt;P&gt;Thanks everyone, &lt;/P&gt;&lt;P&gt;Filip.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jan 2016 09:28:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/format-wkt-to-nearest-meter/m-p/535821#M41975</guid>
      <dc:creator>FilipKrál</dc:creator>
      <dc:date>2016-01-19T09:28:04Z</dc:date>
    </item>
  </channel>
</rss>

