<?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: Getting the Latitude of Origin for a spatial reference in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/getting-the-latitude-of-origin-for-a-spatial/m-p/497170#M39058</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks Shawn,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I agree with that this seems to be an error of ommission and really expected it just to be there.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But your solution of exporting the spatial reference to a string and then extracting the latitude of origin using regex was the key.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I had not seen the extractToString prior to now but I can think of other ways to use it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;tim&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 06 Jun 2013 10:25:29 GMT</pubDate>
    <dc:creator>timloesch</dc:creator>
    <dc:date>2013-06-06T10:25:29Z</dc:date>
    <item>
      <title>Getting the Latitude of Origin for a spatial reference</title>
      <link>https://community.esri.com/t5/python-questions/getting-the-latitude-of-origin-for-a-spatial/m-p/497162#M39050</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Greetings,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm using Python to extract the parameters of projected coordinate systems but I'm finding that the SpatialReference object does not have a .latitudeOfOrigin property that I need to extract. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I look at the projection parameters in ArcMap the latitude of origin is there but I cannot find where to access that value in the SpatialReference object. I can get all of the other parameters but this seems to be missing.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can someone point me in the right direction?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;tim&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Jun 2013 20:12:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/getting-the-latitude-of-origin-for-a-spatial/m-p/497162#M39050</guid>
      <dc:creator>timloesch</dc:creator>
      <dc:date>2013-06-05T20:12:33Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the Latitude of Origin for a spatial reference</title>
      <link>https://community.esri.com/t5/python-questions/getting-the-latitude-of-origin-for-a-spatial/m-p/497163#M39051</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;NOTE&lt;/STRONG&gt;: as of Version 10.3, the SpatialReference object contains the "latitudeOfOrigin" property, and the trick below is unncessary.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Hi Tim,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;It looks like a property which should be included in the SpatialReference object, but I don't see it either. For a quick and dirty hack, you can pull the relevant string out of the exportToString() results:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
import re 
# a projection with a latitude of origin property 
proj = 'NAD 1983 Contiguous USA Albers'&amp;nbsp; 
sr = arcpy.SpatialReference(proj)&amp;nbsp; 
lat_of_origin_regex = "Latitude_Of_Origin',(\d+\.?\d*)]"
match = re.search(lat_of_origin_regex, sr.exportToString())
if match:
 lat_of_origin = float(match.groups()[0])
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "{0} has latitude of origin {1}".format(proj, lat_of_origin)
else:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "no latitude of origin detected."&lt;/PRE&gt;&lt;DIV style="display: none;"&gt; &lt;/DIV&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Set up your own spatial reference object in the code above, and you should be able to use the lat_of_origin variable to get what you need.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;cheers, Shaun&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:51:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/getting-the-latitude-of-origin-for-a-spatial/m-p/497163#M39051</guid>
      <dc:creator>ShaunWalbridge</dc:creator>
      <dc:date>2021-12-11T21:51:01Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the Latitude of Origin for a spatial reference</title>
      <link>https://community.esri.com/t5/python-questions/getting-the-latitude-of-origin-for-a-spatial/m-p/497164#M39052</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Seems like a bug to not have that property available...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Jun 2013 22:11:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/getting-the-latitude-of-origin-for-a-spatial/m-p/497164#M39052</guid>
      <dc:creator>ChrisSnyder</dc:creator>
      <dc:date>2013-06-05T22:11:39Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the Latitude of Origin for a spatial reference</title>
      <link>https://community.esri.com/t5/python-questions/getting-the-latitude-of-origin-for-a-spatial/m-p/497165#M39053</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;One option would be to open the *.prj file (just a text file) and extract that from there (PARAMETER["Latitude_Of_Origin",45.33333333333334]PARAMETER["Latitude_Of_Origin",45.33333333333334]) for my WKID.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;R_&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I see this is more or less the same that Shaun mentioned above except he gets it from the sr object, not the file (not sure if one is faster), but the match code is pretty much the same.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Jun 2013 22:34:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/getting-the-latitude-of-origin-for-a-spatial/m-p/497165#M39053</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2013-06-05T22:34:29Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the Latitude of Origin for a spatial reference</title>
      <link>https://community.esri.com/t5/python-questions/getting-the-latitude-of-origin-for-a-spatial/m-p/497166#M39054</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Note there are no more system-based .prj file in v10.1 anymore (!!!!) But you can manufacture one via the SR's exportToString() method and then write it to a file.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Jun 2013 22:43:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/getting-the-latitude-of-origin-for-a-spatial/m-p/497166#M39054</guid>
      <dc:creator>ChrisSnyder</dc:creator>
      <dc:date>2013-06-05T22:43:18Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the Latitude of Origin for a spatial reference</title>
      <link>https://community.esri.com/t5/python-questions/getting-the-latitude-of-origin-for-a-spatial/m-p/497167#M39055</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Note there are no more system-based .prj file in v10.1 anymore (!!!!) But you can manufacture one via the SR's exportToString() method and then write it to a file.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Had not noticed that.&amp;nbsp; There are so many bugs introduced to the new python, I only utilize 10.1 version for capabilities that are not in 10.0 version (at least for the commands that work.. (Like updatecursor is now reserved for Enterprise SDE users only.....)).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I see you can copy the v10.0 prj files over and use them if you like.&amp;nbsp; Was easier for me than to exportToString() method as I didn't need code &lt;span class="lia-unicode-emoji" title=":face_with_open_mouth:"&gt;😮&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;R_&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Jun 2013 22:54:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/getting-the-latitude-of-origin-for-a-spatial/m-p/497167#M39055</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2013-06-05T22:54:40Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the Latitude of Origin for a spatial reference</title>
      <link>https://community.esri.com/t5/python-questions/getting-the-latitude-of-origin-for-a-spatial/m-p/497168#M39056</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Seems like a bug to not have that property available...&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Agreed, I've filed a bug for the problem as NIM092211.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Jun 2013 02:23:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/getting-the-latitude-of-origin-for-a-spatial/m-p/497168#M39056</guid>
      <dc:creator>ShaunWalbridge</dc:creator>
      <dc:date>2013-06-06T02:23:44Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the Latitude of Origin for a spatial reference</title>
      <link>https://community.esri.com/t5/python-questions/getting-the-latitude-of-origin-for-a-spatial/m-p/497169#M39057</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Note there are no more system-based .prj file in v10.1 anymore (!!!!) But you can manufacture one via the SR's exportToString() method and then write it to a file.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If you'd like a full set of PRJ files, you can generate them fairly easily. I've posted a short script which will populate your 'Coordinate Systems' directory with all internal projections here: &lt;/SPAN&gt;&lt;A href="https://gist.github.com/scw/5720029"&gt;https://gist.github.com/scw/5720029&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Jun 2013 07:08:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/getting-the-latitude-of-origin-for-a-spatial/m-p/497169#M39057</guid>
      <dc:creator>ShaunWalbridge</dc:creator>
      <dc:date>2013-06-06T07:08:39Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the Latitude of Origin for a spatial reference</title>
      <link>https://community.esri.com/t5/python-questions/getting-the-latitude-of-origin-for-a-spatial/m-p/497170#M39058</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks Shawn,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I agree with that this seems to be an error of ommission and really expected it just to be there.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But your solution of exporting the spatial reference to a string and then extracting the latitude of origin using regex was the key.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I had not seen the extractToString prior to now but I can think of other ways to use it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;tim&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Jun 2013 10:25:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/getting-the-latitude-of-origin-for-a-spatial/m-p/497170#M39058</guid>
      <dc:creator>timloesch</dc:creator>
      <dc:date>2013-06-06T10:25:29Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the Latitude of Origin for a spatial reference</title>
      <link>https://community.esri.com/t5/python-questions/getting-the-latitude-of-origin-for-a-spatial/m-p/497171#M39059</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks for this answer!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note: with 10.3 you'll need to use lat_of_origin_regex = "latitude_of_origin',(\d+\.?\d*)"&amp;nbsp; with lowercases&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;also, you can also use the factoryCode in the arcpy.SpatialReference()&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Jun 2015 19:54:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/getting-the-latitude-of-origin-for-a-spatial/m-p/497171#M39059</guid>
      <dc:creator>MichaelNesius</dc:creator>
      <dc:date>2015-06-05T19:54:20Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the Latitude of Origin for a spatial reference</title>
      <link>https://community.esri.com/t5/python-questions/getting-the-latitude-of-origin-for-a-spatial/m-p/497172#M39060</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As of ArcGIS 10.3, this issue is fixed and you can directly use the latitudeOfOrigin property:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: andale mono,times;"&gt;&amp;gt;&amp;gt;&amp;gt; sr = arcpy.SpatialReference("NAD 1983 Contiguous USA Albers")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: andale mono,times;"&gt;&amp;gt;&amp;gt;&amp;gt; sr.latitudeOfOrigin&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: andale mono,times;"&gt;23.0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'd use that over the solution I'd originally posted above for any newer release.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Sep 2015 16:16:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/getting-the-latitude-of-origin-for-a-spatial/m-p/497172#M39060</guid>
      <dc:creator>ShaunWalbridge</dc:creator>
      <dc:date>2015-09-08T16:16:33Z</dc:date>
    </item>
  </channel>
</rss>

