<?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: How to programmatically create a .prj file for a CAD drawing in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/how-to-programmatically-create-a-prj-file-for-a/m-p/640094#M21385</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you know the WKID - just the number then it's easy to create one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;&lt;SPAN class="c"&gt;# 32145 is the code for: &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="c"&gt;#&amp;nbsp; NAD 1983 StatePlane Vermont FIPS 4400 (Meters)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="n"&gt;sr&lt;/SPAN&gt; &lt;SPAN class="o"&gt;=&lt;/SPAN&gt; &lt;SPAN class="n"&gt;arcpy&lt;/SPAN&gt;&lt;SPAN class="o"&gt;.&lt;/SPAN&gt;&lt;SPAN class="n"&gt;SpatialReference&lt;/SPAN&gt;&lt;SPAN class="p"&gt;(&lt;/SPAN&gt;&lt;SPAN class="mi"&gt;32145&lt;/SPAN&gt;&lt;SPAN class="p"&gt;)&lt;/SPAN&gt;&lt;BR /&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can now use this sr object in ArcGIS, for example as:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;arcpy.Project_management(r'D:\data\fc.shp', r'D:\data\fc_project', sr)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can get the WKID from EPSG directory &lt;A href="https://www.epsg-registry.org/"&gt;https://www.epsg-registry.org/&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 03 Dec 2015 21:18:09 GMT</pubDate>
    <dc:creator>NobbirAhmed</dc:creator>
    <dc:date>2015-12-03T21:18:09Z</dc:date>
    <item>
      <title>How to programmatically create a .prj file for a CAD drawing</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/how-to-programmatically-create-a-prj-file-for-a/m-p/640070#M21361</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think there must be an ‘easy’ way to do this but I can’t seem to find a comprehensive set of answers for this question.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am given CAD files from Bentley MicroStation (.dgn files) that are projected in a local coordinate system. I then open a blank ArcMap and create a new Projected Coordinate System (they usually are in a Lambert Conformal Conic system, US Survey Feet, have a Geographic Coordinate System of NAD83, and have a series of inputs for the parallels, easting/northing, scale factor, etc). After that, I load the .dgn file and see if it lines up where it is supposed to.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Some code snippets I have seen show how to get to the false easting/northing, 1&lt;SUP&gt;st&lt;/SUP&gt; and 2&lt;SUP&gt;nd&lt;/SUP&gt; standard parallel, and such, but I have not found all of the places to enter in all of the values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope what I am asking makes sense. I am guessing you use the SpatialReference library within arcpy in Python (after I figure out how to program the inputs, I plan on making a form where the user types in certain values, etc). Please show me the direction I need to go for this!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Nov 2015 22:08:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/how-to-programmatically-create-a-prj-file-for-a/m-p/640070#M21361</guid>
      <dc:creator>AdrianWelsh</dc:creator>
      <dc:date>2015-11-30T22:08:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to programmatically create a .prj file for a CAD drawing</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/how-to-programmatically-create-a-prj-file-for-a/m-p/640071#M21362</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="http://desktop.arcgis.com/en/desktop/latest/analyze/arcpy-classes/spatialreference.htm" title="http://desktop.arcgis.com/en/desktop/latest/analyze/arcpy-classes/spatialreference.htm"&gt;SpatialReference—Help | ArcGIS for Desktop&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://desktop.arcgis.com/en/desktop/latest/analyze/python/the-spatial-reference-object.htm" title="http://desktop.arcgis.com/en/desktop/latest/analyze/python/the-spatial-reference-object.htm"&gt;Using the spatial reference class—Help | ArcGIS for Desktop&lt;/A&gt; &lt;/P&gt;&lt;P&gt;The latter contains geographic and projected coordinate information as well as information on transformations, the former, is the Class &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Nov 2015 22:13:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/how-to-programmatically-create-a-prj-file-for-a/m-p/640071#M21362</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2015-11-30T22:13:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to programmatically create a .prj file for a CAD drawing</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/how-to-programmatically-create-a-prj-file-for-a/m-p/640072#M21363</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dan, thanks for the help. I had looked at the SpatialReference class site. I looked at the second link and saw where it had information on creating a spatial reference. However, this ends up showing how to create a feature class with a spatial reference. Is there another Pyhon command that would create just the .prj file? That is essentially what I am initially trying to do. Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Nov 2015 22:53:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/how-to-programmatically-create-a-prj-file-for-a/m-p/640072#M21363</guid>
      <dc:creator>AdrianWelsh</dc:creator>
      <dc:date>2015-11-30T22:53:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to programmatically create a .prj file for a CAD drawing</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/how-to-programmatically-create-a-prj-file-for-a/m-p/640073#M21364</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well there is this &lt;A href="http://desktop.arcgis.com/en/desktop/latest/manage-data/cad/projection-files-for-cad-datasets.htm" title="http://desktop.arcgis.com/en/desktop/latest/manage-data/cad/projection-files-for-cad-datasets.htm"&gt;Projection files for CAD datasets—Help | ArcGIS for Desktop&lt;/A&gt; which uses nothing more than a string.&amp;nbsp; If you are using the same one all the time, basically what you would have to do is create/copy the text contents and make an output filename to match your cad input's filename, with a *.prj extension.&amp;nbsp; If you have a couple that you use, just get the wkt text contents for each and allow the user to select one.&amp;nbsp; Saves a lot of loops.&amp;nbsp; Do be aware, that you will have to create the prj files BEFORE loading the cad data...or at worse, you will have to reload it before the prj takes affect.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Nov 2015 23:21:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/how-to-programmatically-create-a-prj-file-for-a/m-p/640073#M21364</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2015-11-30T23:21:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to programmatically create a .prj file for a CAD drawing</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/how-to-programmatically-create-a-prj-file-for-a/m-p/640074#M21365</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dan, this is how the process is for now. Each project that we do in CAD, a new coordinate system is created - a local one. Once that project is complete, we want to convert the CAD to GIS. In doing this, we open a blank ArcMap, create the projection file (which inherently assigns the blank ArcMap project to that projection), then load the CAD data to verify it is in the right place.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From looking at the link that you sent, that text string looks exactly like the parameters that I would want to put in (with using user-inputted variables). What I am really looking for is a Python script that will create this .prj file so that I can use it for the CAD drawing and then eventually I will export the drawing into a GDB or something similar. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you know how to utilize the Python script for the SpatialReference class in order to create this .prj file and then throw in the inputs from that CAD text from your link?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks so much for your assistance!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Dec 2015 01:51:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/how-to-programmatically-create-a-prj-file-for-a/m-p/640074#M21365</guid>
      <dc:creator>AdrianWelsh</dc:creator>
      <dc:date>2015-12-01T01:51:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to programmatically create a .prj file for a CAD drawing</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/how-to-programmatically-create-a-prj-file-for-a/m-p/640075#M21366</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you can either rebuild the car yourself or get one prebuilt&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import shutil
src = r"f:\test\2951.prj"
dest = r"f:\test\a_copy_of_2951.prj"
shutil.copy2(src,dest)
print("Copied ... {}\nTo.... {}".format(src,dest))&lt;/PRE&gt;&lt;P&gt;get it?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 03:11:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/how-to-programmatically-create-a-prj-file-for-a/m-p/640075#M21366</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-12T03:11:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to programmatically create a .prj file for a CAD drawing</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/how-to-programmatically-create-a-prj-file-for-a/m-p/640076#M21367</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;And as &lt;A href="https://community.esri.com/migrated-users/3116" target="_blank"&gt;Dan Patterson&lt;/A&gt;​ says, you can rebuild the car yourself (well, I guess I'm not sure if this is rebuilding or getting one prebuilt. It makes a prj file, that's all I know):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;prj = open(r"C:\junk\my_new_prj_file.prj", "w")
crs_string = 'PROJCS["NAD_1983_UTM_Zone_10N",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",-123],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",0],UNIT["Meter",1]]'
prj.write(crs_string)
prj.close()&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 03:11:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/how-to-programmatically-create-a-prj-file-for-a/m-p/640076#M21367</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2021-12-12T03:11:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to programmatically create a .prj file for a CAD drawing</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/how-to-programmatically-create-a-prj-file-for-a/m-p/640077#M21368</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Darren,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I like where this is headed! I took Dan's advice and copied the car into a re-model of the car, so I could have a .prj file that I could manipulate.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I took your code snippet and as long as I use the right values, this seems to work!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, this feels like cheating. Is it easy to screw stuff up when doing it this way? Or should I just double check each time to make sure it was all entered correctly? Is this the best way to modify/create a .prj file with how I am going through the process?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks guys!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Dec 2015 18:06:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/how-to-programmatically-create-a-prj-file-for-a/m-p/640077#M21368</guid>
      <dc:creator>AdrianWelsh</dc:creator>
      <dc:date>2015-12-01T18:06:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to programmatically create a .prj file for a CAD drawing</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/how-to-programmatically-create-a-prj-file-for-a/m-p/640078#M21369</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;be cautious of just using a string representation...I have found that the innocent have sometimes split up the projection line to make it easier to read in the script (it is ridiculously long as you have probably noticed) and ended up with nasty newline characters embedded inside...This can be problematic in some python IDE's and/or setups.&amp;nbsp; You can also generate the necessary string from a list, of lists of elements, but it is ugly and I didn't bother to include it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Dec 2015 18:17:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/how-to-programmatically-create-a-prj-file-for-a/m-p/640078#M21369</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2015-12-01T18:17:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to programmatically create a .prj file for a CAD drawing</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/how-to-programmatically-create-a-prj-file-for-a/m-p/640079#M21370</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;However, this feels like cheating. Is it easy to screw stuff up when doing it this way? Or should I just double check each time to make sure it was all entered correctly? Is this the best way to modify/create a .prj file with how I am going through the process?&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I don't think it's cheating to manipulate the prj file directly. You're just getting over the frightfulness of operating outside of what ESRI wants you to believe is the right and only way to do things (i.e. through the GUI or copying a GUI-made prj file).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Granted, there are smart people making these tools and they may have thought of something you haven't, yet, and built in a check for that. And, yes, it is easy to screw things up if you're not careful. And, it's easier still for someone else to screw things up once you've made something and released it into the wild. As a rule, you should always verify user entry because they will find a way to do it wrong.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Whether this is the best way, I don't know. If you're making different custom CRSes, one way or another you need to get those parameters into a prj file, whether you have them do it through the GUI to copy later or enter the values into your custom tool to write a dynamic prj file.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Dec 2015 18:33:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/how-to-programmatically-create-a-prj-file-for-a/m-p/640079#M21370</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2015-12-01T18:33:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to programmatically create a .prj file for a CAD drawing</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/how-to-programmatically-create-a-prj-file-for-a/m-p/640080#M21371</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dan, I was worried about that which is why I'm hesitant to just use the long string. I have a feeling that it will be more problematic than beneficial.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, I guess I do not understand how to modify all of the SpatialReference elements within Python. I like using the copy method to make a new (or a copy of a) projection file. But how do you go in to change the elements? For instance, if I wanted to change the name of the projection (which is a read/write property), how do I do that? (Sorry for being so inept in Python!)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I write it this way, this is what I get&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;gt;&amp;gt;&amp;gt; import arcpy
&amp;gt;&amp;gt;&amp;gt; sr = arcpy.SpatialReference(r"C:\Users\AWelsh\Documents\ArcGIS\TempPlaceHolder.prj")
&amp;gt;&amp;gt;&amp;gt; print sr.name
TempPlaceHolder
&amp;gt;&amp;gt;&amp;gt; sr.name = "TempPrj"
&amp;gt;&amp;gt;&amp;gt; print sr.name
TempPlaceHolder
&amp;gt;&amp;gt;&amp;gt; &lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know I am missing something simple but I am not sure what it is.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 03:11:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/how-to-programmatically-create-a-prj-file-for-a/m-p/640080#M21371</guid>
      <dc:creator>AdrianWelsh</dc:creator>
      <dc:date>2021-12-12T03:11:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to programmatically create a .prj file for a CAD drawing</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/how-to-programmatically-create-a-prj-file-for-a/m-p/640081#M21372</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The prj file is just a text file....edit it as such.&amp;nbsp; It doesn't matter.&amp;nbsp; You can do what you want with the text string just as long as the numeric parameters are valid.&amp;nbsp; Esri no longer produces a series of files *.prj for example, but now generates the projection description from the details.&amp;nbsp; Since you are working with cad files, you need the *.prj so copying and changing the name doesn't affect anything.&amp;nbsp; For example, a shapefile and all its fiddly bits ( shp, dbf, shx, etc etc ) associates a file name to a whole bunch of extensions...one of those is the *.prj file, as long is the naming is consistent you can copy one file to another, renaming it as I did.&amp;nbsp; As you will notice, there is nothing in the file itself that identifies what it is...except a whole bunch of numbers.&amp;nbsp; This is cloning...as long is the functionality is the same...who cares what it is called! (Dolly.prj might take exception)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Dec 2015 18:50:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/how-to-programmatically-create-a-prj-file-for-a/m-p/640081#M21372</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2015-12-01T18:50:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to programmatically create a .prj file for a CAD drawing</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/how-to-programmatically-create-a-prj-file-for-a/m-p/640082#M21373</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dan, I liked the nod to Dolly the clone. I get what you are saying about all the rip rap of the former shapefile and, you're right, the *.prj file is important with CAD files (why can't we all just get along and all use GIS??). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The naming isn't really my concern; I just want to be able to get into the SpatialReference class of the .prj file that I created and change the values of certain properties (like false Easting, etc) based on user input. When I try to change these kind of values with the sad code snippet I placed above, the values do not change. How do I change these values and make them stick?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Dec 2015 19:12:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/how-to-programmatically-create-a-prj-file-for-a/m-p/640082#M21373</guid>
      <dc:creator>AdrianWelsh</dc:creator>
      <dc:date>2015-12-01T19:12:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to programmatically create a .prj file for a CAD drawing</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/how-to-programmatically-create-a-prj-file-for-a/m-p/640083#M21374</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well...I have done this in the past with no problem, ... assuming you data in the file are within acceptable range of the values!&amp;nbsp; Changing the prj central meridian DOES NOT move the file objects to a new location.&amp;nbsp; You have to change the geometry to do this and this means that you have to project it from one coordinate system to another.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I live in a classic area where this is issue arises all the time.&amp;nbsp; Our local files are often given in MTM and UTM&lt;/P&gt;&lt;P&gt;now MTM is a Modified Transverse Mercator vs a Universal Transverse Mercator.&amp;nbsp; In short, the Easting values differ by about 100,000-ish or so and the Northings are relatively the same.&amp;nbsp; One might be tempted just to switch and rename *.prj files to automagically move the coordinates to a new location. Not! I can't make MTM line up with UTM just by switching the prj file...the coordinates have to be projected and a new file created.&amp;nbsp; Dolly cannot be made into anything other than her genes allowed for. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Dec 2015 19:24:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/how-to-programmatically-create-a-prj-file-for-a/m-p/640083#M21374</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2015-12-01T19:24:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to programmatically create a .prj file for a CAD drawing</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/how-to-programmatically-create-a-prj-file-for-a/m-p/640084#M21375</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dan, I understand what you are saying about how this can go wrong quickly. I just need to input values into my .prj file from a specified user input based on the survey of the CAD drawing. These are known values from the surveyor so they are more than likely correct and will fit within the bounds of the projection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When looking at the &lt;A href="http://desktop.arcgis.com/en/desktop/latest/analyze/arcpy-classes/spatialreference.htm"&gt;SpatialReference &lt;/A&gt;class library, I see that most of the properties are read and write. But, why is it that I cannot write to change certain values like "name" or "falseEasting" or other ones that are indicated as read/write? Are these really not read/write but read only?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is the only way to change properties to go into the "set" properties towards the bottom of that page (like setDomain and such)?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Dec 2015 20:37:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/how-to-programmatically-create-a-prj-file-for-a/m-p/640084#M21375</guid>
      <dc:creator>AdrianWelsh</dc:creator>
      <dc:date>2015-12-01T20:37:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to programmatically create a .prj file for a CAD drawing</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/how-to-programmatically-create-a-prj-file-for-a/m-p/640085#M21376</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;the read only parameters are your clue that you have to use the Project tool...which you can use its code snippet, you can only create so much within arcpy BECAUSE they don't want you to do what you want to do &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Dec 2015 22:26:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/how-to-programmatically-create-a-prj-file-for-a/m-p/640085#M21376</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2015-12-01T22:26:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to programmatically create a .prj file for a CAD drawing</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/how-to-programmatically-create-a-prj-file-for-a/m-p/640086#M21377</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Buuuuuut, the &lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#/SpatialReference/018z0000000v000000/"&gt;help &lt;/A&gt;says 'name' (at least) is read/write, which I guess is a mistake judging by Adrian's example. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Dec 2015 22:35:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/how-to-programmatically-create-a-prj-file-for-a/m-p/640086#M21377</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2015-12-01T22:35:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to programmatically create a .prj file for a CAD drawing</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/how-to-programmatically-create-a-prj-file-for-a/m-p/640087#M21378</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;the important ones that you shouldn't touch are read only, which is what we are trying to clarify, but just in case the help isn't reference enough...&lt;A href="http://desktop.arcgis.com/en/desktop/latest/analyze/arcpy-classes/spatialreference.htm" title="http://desktop.arcgis.com/en/desktop/latest/analyze/arcpy-classes/spatialreference.htm"&gt;SpatialReference—Help | ArcGIS for Desktop&lt;/A&gt; in case people don't read the previous threads.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Dec 2015 23:16:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/how-to-programmatically-create-a-prj-file-for-a/m-p/640087#M21378</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2015-12-01T23:16:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to programmatically create a .prj file for a CAD drawing</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/how-to-programmatically-create-a-prj-file-for-a/m-p/640088#M21379</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It seems that Darren is right that there is a mistake in the properties. All the read/write options are really read only.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In any case, I have conceded to just using the projection string that Dan &lt;A href="http://desktop.arcgis.com/en/desktop/latest/manage-data/cad/projection-files-for-cad-datasets.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;pointed out&lt;/A&gt; and have successfully recreated my own string based on some variables. But, I still am stuck with making the string file &lt;EM&gt;stick&lt;/EM&gt;!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy

#User defined variables (to be actually defined later)
#Project name related
PIN = 12345
ProjName = "New_Project"

#Projection related
ProjectionName = "Lambert_Conformal_Conic"
FalseEasting = 640811.6365
FalseNorthing = -436753.4539
CentralMeridian = -111.5
StandardParallel1 = 40.65
StandardParallel2 = 39
ScaleFactor = 1.000240774
LatOfOrigin = 38.3333
LinearUnit = "Foot_US"
MetersPerFoot = 0.3048006096
#Geographic Coordinate System
GeoCS = '"GCS_NAD_1983_2011",DATUM["D_NAD_1983_2011",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["egree",0.0174532925199433]'


#The string for the projection with user inputted variables
 projString = ('PROJCS["' + str(PIN) + '_' + ProjName +
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '",GEOGCS[' + GeoCS +
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '],PROJECTION["' + ProjectionName +
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '"],PARAMETER["False_Easting",' + str(FalseEasting) +
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '],PARAMETER["False_Northing",' + str(FalseNorthing) +
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '],PARAMETER["Central_Meridian",' + str(CentralMeridian) +
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '],PARAMETER["Standard_Parallel_1",' + str(StandardParallel1) +
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '],PARAMETER["Standard_Parallel_2",' + str(StandardParallel2) +
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '],PARAMETER["Scale_Factor",' + str(ScaleFactor) +
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '],PARAMETER["Latitude_Of_Origin",' + str(LatOfOrigin) +
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '],UNIT["' + LinearUnit + '",' + str(MetersPerFoot) + ']]')

outputPrj = r"C:\Temp\TempPlaceHolder.prj"
spaRef = arcpy.SpatialReference()
spaRef.createFromFile(outputPrj)
spaRef.loadFromString(projString)
print spaRef.exportToString() #edited to fix code...&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From looking at the print out, the string looks as it is intended. But, how do I make it stick? When I look at the actual .prj file, it still has the old projection info. I think I am only changing the "object" in Python but I want to save changes to the .prj file....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 03:11:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/how-to-programmatically-create-a-prj-file-for-a/m-p/640088#M21379</guid>
      <dc:creator>AdrianWelsh</dc:creator>
      <dc:date>2021-12-12T03:11:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to programmatically create a .prj file for a CAD drawing</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/how-to-programmatically-create-a-prj-file-for-a/m-p/640089#M21380</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="background-color: inherit; color: black; font-weight: inherit; font-size: 9pt !important; font-style: inherit;"&gt;You appear to be back to this method, so just open and write the file, without an arcpy SpatialReference whatsoever. To reiterate:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important; background-color: inherit;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt;prj = open(r&lt;/SPAN&gt;&lt;SPAN class="string" style="font-weight: inherit; font-style: inherit; color: blue; font-size: 9pt !important; background-color: inherit;"&gt;"C:\junk\my_new_prj_file.prj"&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt;, &lt;/SPAN&gt;&lt;SPAN class="string" style="font-weight: inherit; font-style: inherit; color: blue; font-size: 9pt !important; background-color: inherit;"&gt;"w"&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt;)&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important; background-color: inherit;"&gt;crs_string = &lt;SPAN class="string" style="font-weight: inherit; font-style: inherit; color: blue; font-size: 9pt !important; background-color: inherit;"&gt;'PROJCS["NAD_1983_UTM_Zone_10N",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",-123],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",0],UNIT["Meter",1]]'&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 9pt !important; background-color: inherit;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important; background-color: inherit;"&gt;prj.write(crs_string)&amp;nbsp; &lt;/SPAN&gt;
&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important; background-color: inherit;"&gt;prj.close() &lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; font-size: 9pt !important; background-color: inherit;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 03:11:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/how-to-programmatically-create-a-prj-file-for-a/m-p/640089#M21380</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2021-12-12T03:11:59Z</dc:date>
    </item>
  </channel>
</rss>

