|
|
| GeoCommunity Mailing List |
| |
| Mailing List Archives |
| Subject: | RE: [gislist] adding any exe in arc toolbox for arcgis 9 |
| Date: |
06/14/2004 01:00:01 PM |
| From: |
Ivan Lucena |
|
|
You should write a script in Python and then configure it as tool in ArcToolbox 9.
See script example at the end of this message.
> -----Original Message----- > From: Zach Travis [mailto:travisz@cityofmobile.org] > Sent: Monday, June 14, 2004 12:23 PM > To: Gislist-Bounces: Gislist At Geocomm > Subject: [gislist] adding any exe in arc toolbox for arcgis 9 > > > using arctoolbox in 8.3 i was able to add any exe into arctoolbox. i'm having trouble figuring out how to do the same in arc gis 9. i have a simple > exe program(vb6,standard exe) which i use often. any ideas? thanks >
# # --------------------------------------------------------------------------- # MRTSwath.py # Created on: Mon Apr 12 2004 03:28:29 PM # # Usage: MRTSwath <parameters> # # * MODIS Reprojection Tool Swath (MRTSwath) is distributed by USGS EROS Data # Center # --------------------------------------------------------------------------- #
# Import system modules import sys, string, os, win32com.client
# Create the Geoprocessor object gp = win32com.client.Dispatch('esriGeoprocessing.GpDispatch.1')
# Script_arguments... input_file = sys.argv[1] output_file = sys.argv[2] geolocation_file = sys.argv[3] output_file_format = sys.argv[4] #optional SDS_name = sys.argv[5] #optional resampling_type = sys.argv[6] #optional output_projection = sys.argv[7] #optional output_projection_parameters = sys.argv[8] #optional output_pixel_sizes = sys.argv[9] #optional output_upper_left_corner = sys.argv[10] #optional output_lower_right_corner = sys.argv[11] #optional output_zone_number = sys.argv[12] #optional output_spatial_subset_type = sys.argv[13] #optional output_sphere_number = sys.argv[14] #optional input_upper_left_corner = sys.argv[15] #optional output_data_type = sys.argv[16] #optional
# Command Preparation
if geolocation_file == '#': geolocation_file = input_file
parameters = [os.environ.get('MRTDATADIR') + '\..\bin\swath2grid.exe' , '-if=' + input_file , '-of=' + output_file , '-gf=' + geolocation_file ]
if output_file_format != '#': parameters = parameters + ['-off=' + output_file_format] if SDS_name != '#': parameters = parameters + ['-sds=' + SDS_name] if resampling_type != '#': parameters = parameters + ['-kk=' + resampling_type] if output_projection != '#': parameters = parameters + ['-oproj=' + output_projection] if output_projection_parameters != '#': parameters = parameters + ['-oprm="' + output_projection_parameters + '"'] if output_pixel_sizes != '#': parameters = parameters + ['-opsz=' + output_pixel_sizes] if output_upper_left_corner != '#': parameters = parameters + ['-oul=' + output_upper_left_corner] if output_lower_right_corner != '#': parameters = parameters + ['-olr=' + output_lower_right_corner] if output_zone_number != '#': parameters = parameters + ['-ozn=' + output_zone_number] if output_spatial_subset_type != '#': parameters = parameters + ['-osst=' + output_spatial_subset_type] if output_sphere_number != '#': parameters = parameters + ['-osp=' + output_sphere_number] if input_upper_left_corner != '#': parameters = parameters + ['-iul=' + input_upper_left_corner] if output_data_type != '#': parameters = parameters + ['-oty=' + output_data_type]
# Call the executable
os.spawnv(os.P_WAIT, parameters[0], parameters)
# Disconnect COM Server
gp = 0
_______________________________________________ gislist mailing list gislist@lists.geocomm.com http://lists.geocomm.com/mailman/listinfo/gislist
_________________________________ This list is brought to you by The GeoCommunity http://www.geocomm.com/
Get Access to the latest GIS & Geospatial Industry RFPs and bids http://www.geobids.com
|
|

Sponsored by:

For information regarding advertising rates Click Here!
|