<?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: current extent in geographic coordinates using python in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/current-extent-in-geographic-coordinates-using/m-p/242677#M18871</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Hi Bryan,&lt;BR /&gt;&lt;BR /&gt;You can try using the following GP tool which will copy the coordinates in decimal degress to your clipboard:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://epro.maps.arcgis.com/home/item.html?id=e68ca4b6880f477ca73b3557546dc49b"&gt;http://epro.maps.arcgis.com/home/item.html?id=e68ca4b6880f477ca73b3557546dc49b&lt;/A&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The tool works to copy the coordinates for the entered points (which I don't want to do, I want to read the current view extent).&amp;nbsp; But it only copies the coordinates in the current coordinate system, which in my case, isn't decimal degrees, it's a state plane projection.&amp;nbsp; The tool solution requires more steps (and additional functionality) than just manually changing things and copying them.&amp;nbsp; But thanks for trying....&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 20 Nov 2012 14:50:55 GMT</pubDate>
    <dc:creator>BryanTaylor</dc:creator>
    <dc:date>2012-11-20T14:50:55Z</dc:date>
    <item>
      <title>current extent in geographic coordinates using python</title>
      <link>https://community.esri.com/t5/python-questions/current-extent-in-geographic-coordinates-using/m-p/242675#M18869</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Here is my problem:&amp;nbsp; I have been using the maptokml tool extensively.&amp;nbsp; My map documents are not in geographic coordinates, nor are the other users map documents that I support.&amp;nbsp; When I use the maptokml tool, I am constantly having to MANUALLY change the display coordinates to decimal degrees and manually enter them in the extent box every time I want to export the current view and then change the data frame display coordinates back.&amp;nbsp; This is terribly annoying, time consuming, and error-prone.&amp;nbsp; I would like a simple method or routine to get the geographic coordinates of the current map view so that I can run them through the maptokml tool in a script to automate this process.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For the record, I wasted the better part of a day writing a script to get the current view extent, create a polygon, put it into a temp feature class, reproject that feature class, create a cursor, read the extent of the polygon feature (or read the extent of the feature class) and then plug those into the maptokml tool.&amp;nbsp; It was painful, full of errors (a lot of errors from bad syntax in ESRI help), frustrating, and is still not working correctly.&amp;nbsp; It never reprojected the coordinates for the polygon despite creating a new spatial reference and creating the polygon with that reference.&amp;nbsp; I'm just burned out.....anybody have a working tool or suggestion that I might run with?&amp;nbsp; Should I just try to change the current dataframe projection?&amp;nbsp; Reproject a polygon/feature class and then query the extent?&amp;nbsp; Read the display coordinates (if that is possible)??&amp;nbsp; HHHEEELLPPPPP!!!!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in advance....&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Nov 2012 00:07:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/current-extent-in-geographic-coordinates-using/m-p/242675#M18869</guid>
      <dc:creator>BryanTaylor</dc:creator>
      <dc:date>2012-11-20T00:07:14Z</dc:date>
    </item>
    <item>
      <title>Re: current extent in geographic coordinates using python</title>
      <link>https://community.esri.com/t5/python-questions/current-extent-in-geographic-coordinates-using/m-p/242676#M18870</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Bryan,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can try using the following GP tool which will copy the coordinates in decimal degress to your clipboard:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://epro.maps.arcgis.com/home/item.html?id=e68ca4b6880f477ca73b3557546dc49b"&gt;http://epro.maps.arcgis.com/home/item.html?id=e68ca4b6880f477ca73b3557546dc49b&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Nov 2012 12:35:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/current-extent-in-geographic-coordinates-using/m-p/242676#M18870</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2012-11-20T12:35:07Z</dc:date>
    </item>
    <item>
      <title>Re: current extent in geographic coordinates using python</title>
      <link>https://community.esri.com/t5/python-questions/current-extent-in-geographic-coordinates-using/m-p/242677#M18871</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Hi Bryan,&lt;BR /&gt;&lt;BR /&gt;You can try using the following GP tool which will copy the coordinates in decimal degress to your clipboard:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://epro.maps.arcgis.com/home/item.html?id=e68ca4b6880f477ca73b3557546dc49b"&gt;http://epro.maps.arcgis.com/home/item.html?id=e68ca4b6880f477ca73b3557546dc49b&lt;/A&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The tool works to copy the coordinates for the entered points (which I don't want to do, I want to read the current view extent).&amp;nbsp; But it only copies the coordinates in the current coordinate system, which in my case, isn't decimal degrees, it's a state plane projection.&amp;nbsp; The tool solution requires more steps (and additional functionality) than just manually changing things and copying them.&amp;nbsp; But thanks for trying....&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Nov 2012 14:50:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/current-extent-in-geographic-coordinates-using/m-p/242677#M18871</guid>
      <dc:creator>BryanTaylor</dc:creator>
      <dc:date>2012-11-20T14:50:55Z</dc:date>
    </item>
    <item>
      <title>Re: current extent in geographic coordinates using python</title>
      <link>https://community.esri.com/t5/python-questions/current-extent-in-geographic-coordinates-using/m-p/242678#M18872</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The tool should create the coordinates in decimal degrees.&amp;nbsp; I tested against a feature class added to ArcMap (both the feature class and data frame were set to State Plane Feet).&amp;nbsp; I zoomed to the extent I wanted, added a point to the lower left corner, then to the upper right (which will give me the extent).&amp;nbsp; After pasting the results from the clipboard to notepad, the coordinates were in decimal degrees.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Nov 2012 14:59:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/current-extent-in-geographic-coordinates-using/m-p/242678#M18872</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2012-11-20T14:59:04Z</dc:date>
    </item>
    <item>
      <title>Re: current extent in geographic coordinates using python</title>
      <link>https://community.esri.com/t5/python-questions/current-extent-in-geographic-coordinates-using/m-p/242679#M18873</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You wanted simple: This is about as simple as it gets with this kind of stuff:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy&amp;nbsp; mxd = arcpy.mapping.MapDocument("Current") #Check for layout view if mxd.activeView == "PAGE_LAYOUT": &amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddWarning( "Does not work in " + &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "layout view, please change to data view") &amp;nbsp;&amp;nbsp;&amp;nbsp; sys.exit() #or whatever &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else: &amp;nbsp;&amp;nbsp;&amp;nbsp; dataframe_string = mxd.activeView &amp;nbsp;&amp;nbsp;&amp;nbsp; dataframe = arcpy.mapping.ListDataFrames(mxd, dataframe_string)[0] &amp;nbsp;&amp;nbsp;&amp;nbsp; oldspatialref = dataframe.spatialReference&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; spatialref = 'c:/work/arcview10/misc/WGS1984.prj'&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; #set to wgs84 &amp;nbsp;&amp;nbsp;&amp;nbsp; dataframe.spatialReference = spatialref&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; #get coors of extent center in new coordinate system &amp;nbsp;&amp;nbsp;&amp;nbsp; x = (dataframe.extent.XMin + dataframe.extent.XMax)/2 &amp;nbsp;&amp;nbsp;&amp;nbsp; y = (dataframe.extent.YMin + dataframe.extent.YMax)/2&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; # set dataframe spatial ref back &amp;nbsp;&amp;nbsp;&amp;nbsp; dataframe.spatialReference = oldspatialref&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; #now do what you need to with the wgs84 coors&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Note the hard coded path to the wgs84 projection file, you will have to change that to suit your situation.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If this is not exactly what you want, hopefully it will give you some ideas and you can get your work done.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;good luck,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Mike&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Nov 2012 15:34:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/current-extent-in-geographic-coordinates-using/m-p/242679#M18873</guid>
      <dc:creator>MikeHunter</dc:creator>
      <dc:date>2012-11-20T15:34:18Z</dc:date>
    </item>
    <item>
      <title>Re: current extent in geographic coordinates using python</title>
      <link>https://community.esri.com/t5/python-questions/current-extent-in-geographic-coordinates-using/m-p/242680#M18874</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;The tool should create the coordinates in decimal degrees.&amp;nbsp; I tested against a feature class added to ArcMap (both the feature class and data frame were set to State Plane Feet).&amp;nbsp; I zoomed to the extent I wanted, added a point to the lower left corner, then to the upper right (which will give me the extent).&amp;nbsp; After pasting the results from the clipboard to notepad, the coordinates were in decimal degrees.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am using the same data frame projection (state plane) and all my layers are state plane also.&amp;nbsp; I had to load the script into the tool, then I didn't have the pywin32 module loaded either, so I installed that.&amp;nbsp; When I ran the tool, I did get all the coordinates, but they were also in state plane and not geographic.&amp;nbsp; With that said, the clipboard info that your answer provided will be extremely handy going into the future, so thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Nov 2012 00:20:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/current-extent-in-geographic-coordinates-using/m-p/242680#M18874</guid>
      <dc:creator>BryanTaylor</dc:creator>
      <dc:date>2012-11-21T00:20:26Z</dc:date>
    </item>
    <item>
      <title>Re: current extent in geographic coordinates using python</title>
      <link>https://community.esri.com/t5/python-questions/current-extent-in-geographic-coordinates-using/m-p/242681#M18875</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;You wanted simple: This is about as simple as it gets with this kind of stuff:&lt;BR /&gt;&lt;BR /&gt;Note the hard coded path to the wgs84 projection file, you will have to change that to suit your situation.&lt;BR /&gt;&lt;BR /&gt;If this is not exactly what you want, hopefully it will give you some ideas and you can get your work done.&lt;BR /&gt;&lt;BR /&gt;good luck,&lt;BR /&gt;Mike&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This IS exactly what I was looking for.&amp;nbsp; I was going down this path today before I left work, but only after wasting time tweaking and undoing what I did yesterday.&amp;nbsp; Thanks for the simple and effective answer....&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Bryan&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Nov 2012 00:23:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/current-extent-in-geographic-coordinates-using/m-p/242681#M18875</guid>
      <dc:creator>BryanTaylor</dc:creator>
      <dc:date>2012-11-21T00:23:46Z</dc:date>
    </item>
  </channel>
</rss>

