<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal">Hello,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I am in the process of trying to automate the update process for my mapserver GIS data.  As part of the process I am using shptree to build spatial indexes.  I created a batch file (.bat) that will set all the paths and environment variables
 then run shptree on my new GIS layers.  This batch file works fine on its own.  My next that I would like to do is call this batch file from ArcGIS so that I can run the “update shptree” script immediately after I update my GIS data.  Although I can use python
 to open up my “update shptree”  batch file, it appears that shptree does not get run at all.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Please let me know If anyone has had any success in using ArcGIS to run shptree.exe. 
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><b>Working Method<o:p></o:p></b></p>
<p class="MsoNormal">Window Explorer <span style="font-family:Wingdings">à</span>  UpdateShptree.bat:  Works great<o:p></o:p></p>
<p class="MsoNormal"><b>Not Working<o:p></o:p></b></p>
<p class="MsoNormal">ArcGIS Catalog / Model Builder  <span style="font-family:Wingdings">
à</span>Python Script to run UpdateShptree.bat  <span style="font-family:Wingdings">
à</span>  UpdateShptree.bat:  does not work <o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Scripts:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Python file:<o:p></o:p></p>
<p class="MsoNormal"># Import native arcgisscripting module<o:p></o:p></p>
<p class="MsoNormal">import sys, string, os, arcgisscripting<o:p></o:p></p>
<p class="MsoNormal"># Create the geoprocessor object<o:p></o:p></p>
<p class="MsoNormal">gp = arcgisscripting.create()<o:p></o:p></p>
<p class="MsoNormal">os.system('C:\\ GIS\\ PublishUpdates\\UpdateMooseQIX.bat')<o:p></o:p></p>
<p class="MsoNormal">gp.SetParameterAsText(0,"True")<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Batch file:<o:p></o:p></p>
<p class="MsoNormal">set PATH=C:\ms4w\Apache\cgi-bin;C:\ms4w\tools\gdal-ogr;C:\ms4w\tools\mapserv;C:\ms4w\tools\shapelib;C:\ms4w\proj\bin;C:\ms4w\tools\shp2tile;C:\ms4w\tools\shpdiff;C:\ms4w\tools\avce00;C:\ms4w\tools\demtools;%PATH%<o:p></o:p></p>
<p class="MsoNormal">set GDAL_DATA=C:\ms4w\gdaldata<o:p></o:p></p>
<p class="MsoNormal">set GDAL_DRIVER_PATH=C:\ms4w\gdalplugins<o:p></o:p></p>
<p class="MsoNormal">set PROJ_LIB=C:\ms4w\proj\nad<o:p></o:p></p>
<p class="MsoNormal">cd C:\ GIS\ PublishUpdates\MOOSEStagingArea\<o:p></o:p></p>
<p class="MsoNormal">shptree ParcelsLyon.shp<o:p></o:p></p>
<p class="MsoNormal">shptree Plats.shp<o:p></o:p></p>
<p class="MsoNormal">shptree Lots.shp<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="color:#1F497D">Sincerely,<o:p></o:p></span></p>
<p class="MsoNormal"><b><span style="color:#1F497D">Mark Volz, GISP</span></b><b><span style="font-size:12.0pt;color:#1F497D"><o:p></o:p></span></b></p>
<p class="MsoNormal"><b><span style="color:#1F497D">Lyon County GIS Coordinator<o:p></o:p></span></b></p>
</div>
</body>
</html>