<?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: Python confussion: creating new X,Y coordinates ! in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/python-confussion-creating-new-x-y-coordinates/m-p/650166#M50597</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you very much, it worked !! &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 20 Dec 2011 08:59:50 GMT</pubDate>
    <dc:creator>HarrietFoster</dc:creator>
    <dc:date>2011-12-20T08:59:50Z</dc:date>
    <item>
      <title>Python confussion: creating new X,Y coordinates !</title>
      <link>https://community.esri.com/t5/python-questions/python-confussion-creating-new-x-y-coordinates/m-p/650162#M50593</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have a text file like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Siteid: 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Condition: good&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;X coordinate: 433207.8362 Y coordinate: 4518107.044&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Trying to work out a square plot of&amp;nbsp; 20m x 20m for each point and to present the coordinates as a text file !! &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Read entire file and print one line at a time&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for line in inFile.readlines():&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; nestList = line.split(",")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; id = nestList[0]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; cnd = nestList[1]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; x = nestList[2]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; y = nestList[3]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; outFile.write("Siteid: " + id + "\n")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; outFile.write("Condition: " + cnd + "\n")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; outFile.write("X Coordinate: " + x + "\n")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; outFile.write("Y Coordinate: " + y + "\n")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; outFile.write("\n")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;print "the file nests2005 has been read and printed"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Close the files&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;inFile.close()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;outFile.close()&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Dec 2011 12:19:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-confussion-creating-new-x-y-coordinates/m-p/650162#M50593</guid>
      <dc:creator>HarrietFoster</dc:creator>
      <dc:date>2011-12-19T12:19:44Z</dc:date>
    </item>
    <item>
      <title>Re: Python confussion: creating new X,Y coordinates !</title>
      <link>https://community.esri.com/t5/python-questions/python-confussion-creating-new-x-y-coordinates/m-p/650163#M50594</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;What exactly is your question? You mention making a 20m x 20m for each coordinate set, are the given coordinates the centerpoint or one of the corners. Do you need it to write to a polygon? If you give a bit more information and possibly a example of a couple lines from your 'inFile', I'll try to help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Rob Jones&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Dec 2011 13:57:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-confussion-creating-new-x-y-coordinates/m-p/650163#M50594</guid>
      <dc:creator>RobertJones6</dc:creator>
      <dc:date>2011-12-19T13:57:10Z</dc:date>
    </item>
    <item>
      <title>Re: Python confussion: creating new X,Y coordinates !</title>
      <link>https://community.esri.com/t5/python-questions/python-confussion-creating-new-x-y-coordinates/m-p/650164#M50595</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;From the text file (.csv file) that has been provided (input file), I need to write a script that calculates new x,y coordinates from the coordinates provided in the input file, and write them to a new text file. Assuming that each of the points in the .csv file is the center point of a square-shaped plot that is 20 meters by 20 meters.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Meaning i would have to write a script that takes the coordinate pairs &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;from .csv and calculate the lower left corner, lower right corner, upper right corner, upper left corner, based on the centre coordinate pair and output the 4 new coordinate pairs for every center &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;coordinate pair to a new text file. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The input file contains:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1 good 433207.8362 4518107.044&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;showing the ID number, description, X coordinate and Y Coordinate.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The code i posted originally extracts this information and creates a list of all different entities and places them into a new text file. Just need to figure out how to work out the 4 new coordinate pairs. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Would it be possible to create a 20m x 20m polygon around the give coordinate pairs and work out the 4 new coordinate pairs from that ? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Many thanks !!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Dec 2011 14:41:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-confussion-creating-new-x-y-coordinates/m-p/650164#M50595</guid>
      <dc:creator>HarrietFoster</dc:creator>
      <dc:date>2011-12-19T14:41:40Z</dc:date>
    </item>
    <item>
      <title>Re: Python confussion: creating new X,Y coordinates !</title>
      <link>https://community.esri.com/t5/python-questions/python-confussion-creating-new-x-y-coordinates/m-p/650165#M50596</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;assuming your coordinates are in meters already...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The below should be a good start at getting the bounding corners for a 20m square&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# replace the x = and y = in your code with this...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;x = float(nestList[2]) #convert coordinates from string&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;y = float(nestList[3]) #convert coordinates from string&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;xMin = x - 10 # half of the size&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;xMax = x + 10 # the other half of the size&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;yMin = y - 10&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;yMax = y + 10&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;outFile.write('bottomLeft: ' + str(xMin) + ',' + str(yMin) + '\n')&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;outFile.write('bottomRight: ' + str(xMax + ',' + str(yMin) + '\n')&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;outFile.write('topRight: ' + str(xMax + ',' + str(yMax) + '\n')&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;outFile.write('topLeft: ' + str(xMin + ',' + str(yMax) + '\n')&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I hope that helps&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Dec 2011 15:05:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-confussion-creating-new-x-y-coordinates/m-p/650165#M50596</guid>
      <dc:creator>RobertJones6</dc:creator>
      <dc:date>2011-12-19T15:05:35Z</dc:date>
    </item>
    <item>
      <title>Re: Python confussion: creating new X,Y coordinates !</title>
      <link>https://community.esri.com/t5/python-questions/python-confussion-creating-new-x-y-coordinates/m-p/650166#M50597</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you very much, it worked !! &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Dec 2011 08:59:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-confussion-creating-new-x-y-coordinates/m-p/650166#M50597</guid>
      <dc:creator>HarrietFoster</dc:creator>
      <dc:date>2011-12-20T08:59:50Z</dc:date>
    </item>
  </channel>
</rss>

