I got this snippet from a friend.
I didn't try it.
*********************************************************************************************************************************************
<SPAN style="font-size: 10.0pt;">import</SPAN> <SPAN style="font-size: 10.0pt;">arcpy</SPAN>
<SPAN style="font-size: 10.0pt;">import</SPAN>
<SPAN style="font-size: 10.0pt;">arcpy</SPAN>
<SPAN style="font-size: 10.0pt;"># Modify the following variables:</SPAN>
<SPAN style="font-size: 10.0pt;"># URL to your service, where clause, fields and token if applicable</SPAN>
<SPAN style="font-size: 10.0pt;">baseURL=</SPAN> <SPAN style="font-size: 10.0pt;">"<A href="http://sampleserver6.arcgisonline.com/arcgis/rest/services/PoolPermits/FeatureServer/1/query" rel="nofollow noopener noreferrer">http://sampleserver6.arcgisonline.com/arcgis/rest/services/PoolPermits/FeatureServer/1/query</A>"</SPAN>
<SPAN style="font-size: 10.0pt;">baseURL=</SPAN>
<SPAN style="font-size: 10.0pt;">"<A href="http://sampleserver6.arcgisonline.com/arcgis/rest/services/PoolPermits/FeatureServer/1/query" rel="nofollow noopener noreferrer">http://sampleserver6.arcgisonline.com/arcgis/rest/services/PoolPermits/FeatureServer/1/query</A>"</SPAN>
<SPAN style="font-size: 10.0pt;">where =</SPAN> <SPAN style="font-size: 10.0pt;">'1=1'</SPAN>
<SPAN style="font-size: 10.0pt;">where =</SPAN>
<SPAN style="font-size: 10.0pt;">'1=1'</SPAN>
<SPAN style="font-size: 10.0pt;">fields ='apn, address, pool_permit'</SPAN>
<SPAN style="font-size: 10.0pt;">token =</SPAN> <SPAN style="font-size: 10.0pt;">''</SPAN>
<SPAN style="font-size: 10.0pt;">token =</SPAN>
<SPAN style="font-size: 10.0pt;">''</SPAN>
<SPAN style="font-size: 10.0pt;">#The above variables construct the query</SPAN>
<SPAN style="font-size: 10.0pt;">query =</SPAN> <SPAN style="font-size: 10.0pt;">"?where={}&outFields={}&returnGeometry=true&f=json&token={}".format(where, fields, token)</SPAN>
<SPAN style="font-size: 10.0pt;">query =</SPAN>
<SPAN style="font-size: 10.0pt;">"?where={}&outFields={}&returnGeometry=true&f=json&token={}".format(where, fields, token)</SPAN>
<SPAN style="font-size: 10.0pt;"># See <A href="http://services1.arcgis.com/help/index.html?fsQuery.html" rel="nofollow noopener noreferrer">http://services1.arcgis.com/help/index.html?fsQuery.html</A> for more info on FS-Query</SPAN>
<SPAN style="font-size: 10.0pt;">fsURL =</SPAN> <SPAN style="font-size: 10.0pt;">baseURL +</SPAN> <SPAN style="font-size: 10.0pt;">query</SPAN>
<SPAN style="font-size: 10.0pt;">fsURL =</SPAN>
<SPAN style="font-size: 10.0pt;">baseURL +</SPAN>
<SPAN style="font-size: 10.0pt;">query</SPAN>
<SPAN style="font-size: 10.0pt;">fs =</SPAN> <SPAN style="font-size: 10.0pt;">arcpy.FeatureSet()</SPAN>
<SPAN style="font-size: 10.0pt;">fs =</SPAN>
<SPAN style="font-size: 10.0pt;">arcpy.FeatureSet()</SPAN>
<SPAN style="font-size: 10.0pt;">fs.load(fsURL)</SPAN>
<SPAN style="font-size: 10.0pt;">arcpy.CopyFeatures_management(fs, r"c:\local\data.gdb\permits")</SPAN>
**********************************************************************************************************************************************
Regards,
Rami
Los miembros registrados pueden publicar, seguir actualizaciones y más. ¿Nuevo aquí? Regístrate gratis.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.