I didn't need to go to the trouble of finding the path to a *.prj.
On the tool properties I entered "GDA 1994 MGA Zone 55" (without the double quotes) in as the Default which replaced it with the very long text equivalent. Then when I opened the tool the spatial reference showed up as GDA_1994_MGA_Zone_55.
WKIDs are also documented at http://spatialreference.org
I know that this is a really old thread, but I think I can help. If I understand the problem correctly, there is an issue with setting a default coordinate system while creating a script tool. If anyone is still having this problem in 2018 here is the solution...
1. In the parameter tab of your script tool you will want to select the coordinate system parameter that you are trying to edit
2. Click the "default" text box in the editing portion of the parameter
3. Type the WKID number of the coordinate system that you want to use as the default coordinate system
You can find the WKID numbers here:
***Coordinate Systems ID's ***Projected ID's
So for example, if you wanted to use NAD 1983 you would type in the number 4269 into the box. Click "apply" and Esri will automatically populate the coordinate system in the format that it likes. Hope this helps someone out!
-Brack
In short, get the spatial reference string in any way and use the string instead of a name. Let me know whether that works.
See the screenshot below - when you select the parameter name you'll see a list of parameter properties below. Click next to Default and type the name of the coordinate system:[ATTACH=CONFIG]19158[/ATTACH]
def initializeParameters(self): """Refine the properties of a tool's parameters. This method is called when the tool is opened.""" prjFile = os.path.join(arcpy.GetInstallInfo()["InstallDir"], "Coordinate Systems/Geographic Coordinate Systems/North America/NAD 1983.prj") spatialRef = arcpy.SpatialReference(prjFile) self.params[1].value = spatialRef.name # parameter 1 is a string, just to test self.params[2].value = spatialRef # parameter 2 is a SpatialReference return
Hi Glenn,it is a little unclear about what you need to do here.Are you trying to get a spatial reference that is not hard-coded in a script?If so, you can get the spatial reference from your input data in the script and then carry it over to the other data you create.This would look like:sr = arcpy.Describe(infc).spatialReference # with infc being your input dataKat
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.