<?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: Personalized Geopreocessing Service (Data extract) problem in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/personalized-geopreocessing-service-data-extract/m-p/216260#M16645</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Problem solved. When I add a toolbox in ArcMap, it references to my local folder. When I publish the geoprocessing service in ArcGIS Server (another server) the toolbox points to the script in the server, that is the original. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I copied the script to the server and I reference it in the toolbox. That's all.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Pau Pérez Puigcerver&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Conselleria de Infraestructuras, Territorio y Medio Ambiente&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://cartoweb.cma.gva.es"&gt;http://cartoweb.cma.gva.es&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 16 Feb 2012 09:14:52 GMT</pubDate>
    <dc:creator>PauPérez_Puigcerver</dc:creator>
    <dc:date>2012-02-16T09:14:52Z</dc:date>
    <item>
      <title>Personalized Geopreocessing Service (Data extract) problem</title>
      <link>https://community.esri.com/t5/python-questions/personalized-geopreocessing-service-data-extract/m-p/216259#M16644</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would like to make a Geoprocessiong Service in ArcGIS Server thats extracts data with a polygon. I have a copy of Extract Data Task and I personalized it. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Instead of make a clip as does the original, I have a SelectByLocation and after a CopyFeatures function. I don't want to clip but to extract features that intersects by the polygon. This is the function I modified (original clip function is commented):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
def clipFeatures(lyr, aoi, featureFormat, zipFolderPath, scratchFolderPath, convertFeaturesDuringClip):
&amp;nbsp;&amp;nbsp;&amp;nbsp; global haveDataInterop
&amp;nbsp;&amp;nbsp;&amp;nbsp; try:
##&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if not convertFeaturesDuringClip and not haveDataInterop:
##&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; raise "LicenseError"

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # get the path and a validated name for the output
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; layerName, outputpath = makeOutputPath(False, lyr, convertFeaturesDuringClip, featureFormat, zipFolderPath, scratchFolderPath)

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # do the clip
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #gp.clip_analysis(lyr, aoi, outputpath)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.SelectLayerByLocation_management(lyr, 'intersect', aoi)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.CopyFeatures_management(lyr, outputpath)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #Message "&amp;nbsp; clipped %s..."
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.AddMessage(gp.GetIDMessage(86135) % lyr)

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # if format needs data interop, convert with data interop
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if not convertFeaturesDuringClip:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # get path to zip
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outputinzip = os.path.join(zipFolderPath, layerName + featureFormat[2])
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if featureFormat[2].lower() in [".dxf", ".dwg", ".dgn"]:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.AddWarning(gp.GetIDMessage(86139))# "..using export to cad.."
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.ExportCAD_conversion(outputpath, featureFormat[1], outputinzip)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if not haveDataInterop:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; raise "LicenseError"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; diFormatString = "%s,%s" % (featureFormat[1], outputinzip)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # run quick export
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.quickexport_interop(outputpath, diFormatString)

&amp;nbsp;&amp;nbsp;&amp;nbsp; except "LicenseError":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #Message "&amp;nbsp; failed to export to %s.&amp;nbsp; The requested formats require the Data Interoperability extension.&amp;nbsp; This extension is currently unavailable."
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.AddWarning(gp.GetIDMessage(86140) % featureFormat[1])
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass

&amp;nbsp;&amp;nbsp;&amp;nbsp; except:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; errorstring = gp.GetMessages(2)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if errorstring.lower().find("failed to execute (quickexport)") &amp;gt; -1:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #Message "&amp;nbsp; failed to export layer %s with Quick Export.&amp;nbsp; Please verify that the format you have specified is valid."
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.AddWarning(gp.GetIDMessage(86141) % lyr)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; elif errorstring.lower().find("failed to execute (clip)") &amp;gt; -1:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #Message "&amp;nbsp; failed to clip layer %s...
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.AddWarning( gp.GetIDMessage(86142) % lyr)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.AddWarning(gp.GetIDMessage(86142) % lyr)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.AddWarning(gp.GetMessages(2))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I executed the function in ArcMap with the dialog, the task works fine. The layers are not clipped. The problem comes when I publish the same service with the Geoprocessing Service. When I test it in ArcGIS Service Directory page, the resulting zip contains layers clipped, when the function I personalized is the same.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I don't understand this, when the task is the same in the Toolbox and the task published as a geoprocessing service.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Does anyone know what happens?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Pau Pérez Puigcerver&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Conselleria de Infraestructuras, Territorio y Medio Ambiente&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://cartoweb.cma.gva.es" rel="nofollow noopener noreferrer" target="_blank"&gt;http://cartoweb.cma.gva.es&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 10:35:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/personalized-geopreocessing-service-data-extract/m-p/216259#M16644</guid>
      <dc:creator>PauPérez_Puigcerver</dc:creator>
      <dc:date>2021-12-11T10:35:30Z</dc:date>
    </item>
    <item>
      <title>Re: Personalized Geopreocessing Service (Data extract) problem</title>
      <link>https://community.esri.com/t5/python-questions/personalized-geopreocessing-service-data-extract/m-p/216260#M16645</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Problem solved. When I add a toolbox in ArcMap, it references to my local folder. When I publish the geoprocessing service in ArcGIS Server (another server) the toolbox points to the script in the server, that is the original. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I copied the script to the server and I reference it in the toolbox. That's all.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Pau Pérez Puigcerver&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Conselleria de Infraestructuras, Territorio y Medio Ambiente&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://cartoweb.cma.gva.es"&gt;http://cartoweb.cma.gva.es&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Feb 2012 09:14:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/personalized-geopreocessing-service-data-extract/m-p/216260#M16645</guid>
      <dc:creator>PauPérez_Puigcerver</dc:creator>
      <dc:date>2012-02-16T09:14:52Z</dc:date>
    </item>
  </channel>
</rss>

