<?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: Make Arcpy use Esri Feature Service in Developers Questions</title>
    <link>https://community.esri.com/t5/developers-questions/make-arcpy-use-esri-feature-service/m-p/703533#M4800</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've got the answer. Esri Nederland helped me out! they provided me this code and advised to read about the Rest API.&amp;nbsp;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy

&lt;SPAN class="comment token"&gt;# Query URL opbouwen op basis van bepaalde postcode&lt;/SPAN&gt;
ppc &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'2623HB'&lt;/SPAN&gt;
url &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'https://services.arcgis.com/nSZVuSZjHpEZZbRo/ArcGIS/rest/services/Postcodevlakken_PC6/FeatureServer/0/query?where=PC6+%3D+%27{}%27&amp;amp;objectIds=&amp;amp;time=&amp;amp;geometry=&amp;amp;geometryType=esriGeometryEnvelope&amp;amp;inSR=&amp;amp;spatialRel=esriSpatialRelIntersects&amp;amp;resultType=none&amp;amp;distance=0.0&amp;amp;units=esriSRUnit_Meter&amp;amp;returnGeodetic=false&amp;amp;outFields=*&amp;amp;returnGeometry=true&amp;amp;returnCentroid=false&amp;amp;multipatchOption=xyFootprint&amp;amp;maxAllowableOffset=&amp;amp;geometryPrecision=&amp;amp;outSR=&amp;amp;datumTransformation=&amp;amp;applyVCSProjection=false&amp;amp;returnIdsOnly=false&amp;amp;returnUniqueIdsOnly=false&amp;amp;returnCountOnly=false&amp;amp;returnExtentOnly=false&amp;amp;returnQueryGeometry=false&amp;amp;returnDistinctValues=false&amp;amp;orderByFields=&amp;amp;groupByFieldsForStatistics=&amp;amp;outStatistics=&amp;amp;having=&amp;amp;resultOffset=&amp;amp;resultRecordCount=&amp;amp;returnZ=false&amp;amp;returnM=false&amp;amp;returnExceededLimitFeatures=true&amp;amp;quantizationParameters=&amp;amp;sqlFormat=none&amp;amp;f=pjson&amp;amp;token='&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;ppc&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# Omzetten van query naar feature class&lt;/SPAN&gt;
fs &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;FeatureSet&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
fs&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;load&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;url&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
fs&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;save&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;r&lt;SPAN class="string token"&gt;'&amp;lt;Pad naar Geodatabase&amp;gt;\PPC6_{}'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;ppc&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Klaar"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 05:35:16 GMT</pubDate>
    <dc:creator>HermanGroeneveld</dc:creator>
    <dc:date>2021-12-12T05:35:16Z</dc:date>
    <item>
      <title>Make Arcpy use Esri Feature Service</title>
      <link>https://community.esri.com/t5/developers-questions/make-arcpy-use-esri-feature-service/m-p/703528#M4795</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm a ArcGIS for Desktop user who is a noob to Python&amp;nbsp;and would like to be pointed in the right direction. How can I use/acces feature services like the one below (directly) through arcpy?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I'm trying to do looks very simple:&lt;/P&gt;&lt;P&gt;1. I have a ZIP-code&amp;nbsp;as input, say '2623HB'&lt;/P&gt;&lt;P&gt;2. Using &lt;A href="https://www.arcgis.com/home/item.html?id=6ddc8fa5f502495782cd031da6ad42da" rel="nofollow noopener noreferrer" target="_blank"&gt;this&lt;/A&gt; Zip-code Web Feature Layer ("Postcodevlakkekken PC 6", provided by Esri Nederland), I want to select the correct polygon by using the SelectLayerByAttributes-function.&lt;/P&gt;&lt;P&gt;3. Export this polygon to a shapefile or maybe even use it as intermediate data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Step 2 gives me problems. In the Modelbuilder I made a very simple scheme, using SelectlayerByAttributes and it works (attached picture). But when I export the model to python , the very same script raises an error, saying:&lt;/P&gt;&lt;P&gt;"ERROR 000732: Layer Name or Table View: Dataset Postcodevlakken PC 6\PC6 does not exist or is not supported"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;how can i acces a feature service with an url like:&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://services.arcgis.com/nSZVuSZjHpEZZbRo/arcgis/rest/services/Postcodevlakken_PC6/FeatureServer" title="https://services.arcgis.com/nSZVuSZjHpEZZbRo/arcgis/rest/services/Postcodevlakken_PC6/FeatureServer" rel="nofollow noopener noreferrer" target="_blank"&gt;https://services.arcgis.com/nSZVuSZjHpEZZbRo/arcgis/rest/services/Postcodevlakken_PC6/FeatureServer&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here is the python code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #808080;"&gt;# ---------------------------------------------------------------------------
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;# selbyattr2.py
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;# Created on: 2019-05-31 09:24:45.00000
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;#   (generated by ArcGIS/ModelBuilder)
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;# Description: 
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;# ---------------------------------------------------------------------------
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;# Import arcpy module
&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;import &lt;/SPAN&gt;arcpy


&lt;SPAN style="color: #808080;"&gt;# Local variables:
&lt;/SPAN&gt;PC6 = &lt;SPAN style="color: #a5c261;"&gt;"Postcodevlakken PC 6&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="color: #a5c261;"&gt;PC6"
&lt;/SPAN&gt;PC6__4_ = PC6

&lt;SPAN style="color: #808080;"&gt;# Process: Select Layer By Attribute
&lt;/SPAN&gt;arcpy.SelectLayerByAttribute_management(PC6&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #a5c261;"&gt;"NEW_SELECTION"&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #a5c261;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;\"&lt;/SPAN&gt;&lt;SPAN style="color: #a5c261;"&gt;PC6&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;\"&lt;/SPAN&gt;&lt;SPAN style="color: #a5c261;"&gt; = '2623HB'"&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:35:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/make-arcpy-use-esri-feature-service/m-p/703528#M4795</guid>
      <dc:creator>HermanGroeneveld</dc:creator>
      <dc:date>2021-12-12T05:35:14Z</dc:date>
    </item>
    <item>
      <title>Re: Make Arcpy use Esri Feature Service</title>
      <link>https://community.esri.com/t5/developers-questions/make-arcpy-use-esri-feature-service/m-p/703529#M4796</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did you build and run the model from within ArcMap?&lt;/P&gt;&lt;P&gt;ie by adding the required layer from the TOC pulldown?&lt;/P&gt;&lt;P&gt;Once the code is in python there is no way that the code knows where&lt;/P&gt;&lt;PRE style="color: #a9b7c6; background-color: #2b2b2b; border: 0px;"&gt;PC6 = &lt;SPAN style="color: #a5c261; border: 0px; font-weight: inherit;"&gt;"Postcodevlakken PC 6&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832; border: 0px; font-weight: inherit;"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="color: #a5c261; border: 0px; font-weight: inherit;"&gt;PC6"&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;is actually on your local storage.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 May 2019 09:50:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/make-arcpy-use-esri-feature-service/m-p/703529#M4796</guid>
      <dc:creator>NeilAyres</dc:creator>
      <dc:date>2019-05-31T09:50:12Z</dc:date>
    </item>
    <item>
      <title>Re: Make Arcpy use Esri Feature Service</title>
      <link>https://community.esri.com/t5/developers-questions/make-arcpy-use-esri-feature-service/m-p/703530#M4797</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your answer, Neil! Indeed, I added the required layer from the TOC and I understand that python can't find the layer among my local storage, thanks for pointing out.&lt;/P&gt;&lt;P&gt;But in what way (without adding from the TOC or storing Web content locally) can I point to the PC6-feature service?&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 May 2019 11:31:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/make-arcpy-use-esri-feature-service/m-p/703530#M4797</guid>
      <dc:creator>HermanGroeneveld</dc:creator>
      <dc:date>2019-05-31T11:31:43Z</dc:date>
    </item>
    <item>
      <title>Re: Make Arcpy use Esri Feature Service</title>
      <link>https://community.esri.com/t5/developers-questions/make-arcpy-use-esri-feature-service/m-p/703531#M4798</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;By using the little envelope thingy at the side to directly navigate to the actual feature in its fgdb or where ever it is. Not just picking it from the layer list.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Jun 2019 09:58:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/make-arcpy-use-esri-feature-service/m-p/703531#M4798</guid>
      <dc:creator>NeilAyres</dc:creator>
      <dc:date>2019-06-03T09:58:28Z</dc:date>
    </item>
    <item>
      <title>Re: Make Arcpy use Esri Feature Service</title>
      <link>https://community.esri.com/t5/developers-questions/make-arcpy-use-esri-feature-service/m-p/703532#M4799</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Uhmmm, maybe a bit silly, but I'm not quiet sure&amp;nbsp;where to look for a little envelope thingy. I'm working in Pycharm/IDLE and ArcGIS for Desktop. Can you help me with a screenshot?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Jun 2019 13:43:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/make-arcpy-use-esri-feature-service/m-p/703532#M4799</guid>
      <dc:creator>HermanGroeneveld</dc:creator>
      <dc:date>2019-06-05T13:43:01Z</dc:date>
    </item>
    <item>
      <title>Re: Make Arcpy use Esri Feature Service</title>
      <link>https://community.esri.com/t5/developers-questions/make-arcpy-use-esri-feature-service/m-p/703533#M4800</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've got the answer. Esri Nederland helped me out! they provided me this code and advised to read about the Rest API.&amp;nbsp;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy

&lt;SPAN class="comment token"&gt;# Query URL opbouwen op basis van bepaalde postcode&lt;/SPAN&gt;
ppc &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'2623HB'&lt;/SPAN&gt;
url &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'https://services.arcgis.com/nSZVuSZjHpEZZbRo/ArcGIS/rest/services/Postcodevlakken_PC6/FeatureServer/0/query?where=PC6+%3D+%27{}%27&amp;amp;objectIds=&amp;amp;time=&amp;amp;geometry=&amp;amp;geometryType=esriGeometryEnvelope&amp;amp;inSR=&amp;amp;spatialRel=esriSpatialRelIntersects&amp;amp;resultType=none&amp;amp;distance=0.0&amp;amp;units=esriSRUnit_Meter&amp;amp;returnGeodetic=false&amp;amp;outFields=*&amp;amp;returnGeometry=true&amp;amp;returnCentroid=false&amp;amp;multipatchOption=xyFootprint&amp;amp;maxAllowableOffset=&amp;amp;geometryPrecision=&amp;amp;outSR=&amp;amp;datumTransformation=&amp;amp;applyVCSProjection=false&amp;amp;returnIdsOnly=false&amp;amp;returnUniqueIdsOnly=false&amp;amp;returnCountOnly=false&amp;amp;returnExtentOnly=false&amp;amp;returnQueryGeometry=false&amp;amp;returnDistinctValues=false&amp;amp;orderByFields=&amp;amp;groupByFieldsForStatistics=&amp;amp;outStatistics=&amp;amp;having=&amp;amp;resultOffset=&amp;amp;resultRecordCount=&amp;amp;returnZ=false&amp;amp;returnM=false&amp;amp;returnExceededLimitFeatures=true&amp;amp;quantizationParameters=&amp;amp;sqlFormat=none&amp;amp;f=pjson&amp;amp;token='&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;ppc&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# Omzetten van query naar feature class&lt;/SPAN&gt;
fs &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;FeatureSet&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
fs&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;load&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;url&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
fs&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;save&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;r&lt;SPAN class="string token"&gt;'&amp;lt;Pad naar Geodatabase&amp;gt;\PPC6_{}'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;ppc&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Klaar"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:35:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/make-arcpy-use-esri-feature-service/m-p/703533#M4800</guid>
      <dc:creator>HermanGroeneveld</dc:creator>
      <dc:date>2021-12-12T05:35:16Z</dc:date>
    </item>
  </channel>
</rss>

