Set default Spatial Reference paramter value

2957
14
07-31-2012 02:30 PM
GlennKammerer
New Contributor II
ArcView 10.0 SP1
Windows XP Pro SP3

I have a standalone script in which one of the parameters is a Spatial Reference. I have figured out how to set default values for other data types in the script properties window, but I can't figure out how to do it for a Spatial Reference. Do I have to do it within the script? Any help or suggestions would be greatly appreciated.
Tags (2)
0 Kudos
14 Replies
GlennKammerer
New Contributor II
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]


That's what I tried doing, many times and many spelling variations. As soon as I clicked "Apply" or "OK", the default name I had entered would disappear. I guess I never hit on the correct spelling of the spatial reference name. See the third post in the thread.
0 Kudos
NobbirAhmed
Esri Regular Contributor
Looks like in 10.0 the process was not as intuitive 😞 Here is my find - you can do it in two ways:

1. Go to ArcGIS\Desktop10.0\Coordinate Systems folder under <ArcGIS install directory>
    - find the projection file you want to make default.
    - open the projection file in a text editor (such as Notepad)
    - copy the content (a long string)
    - paste the content in the default row of the parameter (as shown below).

    [ATTACH=CONFIG]19184[/ATTACH]

2. The second option is to run Create Spatial Reference tool (under Data Management toolbox) with your spatial reference as input. The tool result dialog will show the full string of the spatial reference. Copy the string without including the double-quotes.
    - Paste the string into default row of the parameter.

In short, get the spatial reference string in any way and use the string instead of a name. Let me know whether that works.
0 Kudos
GlennKammerer
New Contributor II
...snip...


In short, get the spatial reference string in any way and use the string instead of a name. Let me know whether that works.


Oh that's what I already had done and figured out. See the seventh post of this thread.
0 Kudos
B-
by
New Contributor II

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

0 Kudos
curtvprice
MVP Esteemed Contributor

WKIDs are also documented at http://spatialreference.org

0 Kudos