<?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: Adding WFS to webmap using Python API in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/adding-wfs-to-webmap-using-python-api/m-p/1538782#M10665</link>
    <description>&lt;P&gt;Well it is possible in ArcGISPro without any python programming. All you do is add a WFS server, tweak the URL, add any cql_filter expressions and get the layers listed. Add these to a map and tweak symbology, visible items and definition queries, layer names etc. Then select all the layers and Share&amp;gt;featurelayer&amp;gt;publish. This will create a better FeatureLayerCollection in AGOL. Why better? Because you can edit, make WebMaps and anything else. The only drawback? It is not dynamic. But wait, neither is WFS usually. The one I have just extracted only updates nightly anyway.&lt;/P&gt;&lt;P&gt;So how can you replicate this in Python. In principle duplicate the steps:&lt;/P&gt;&lt;P&gt;1. Use the requests module to set up a request on the WFS endpoint just like the WFS server&lt;/P&gt;&lt;P&gt;2. Download each sublayer as a json extract and move into a Pandas SpatiallyEnabledDataFrame. Not quite so easy in AGOL because the geopandas module is missing. In principle it should work but is not supported directly. But you can copy a geopandas dataframe to an esri spatialdataframe.&lt;/P&gt;&lt;P&gt;3. upload the sdf to AGOL with the GeoAccessor esri extension to arcgis.&lt;/P&gt;&lt;P&gt;If the WFS data can be queried for changes you could use the gis.content.edit() functions to just add new records. Don't know about delete records.&lt;/P&gt;</description>
    <pubDate>Mon, 16 Sep 2024 05:32:01 GMT</pubDate>
    <dc:creator>KimOllivier</dc:creator>
    <dc:date>2024-09-16T05:32:01Z</dc:date>
    <item>
      <title>Adding WFS to webmap using Python API</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/adding-wfs-to-webmap-using-python-api/m-p/1325405#M8974</link>
      <description>&lt;P&gt;Has anyone has success using the Python API to add OGC WFS data to webmaps? Either directly or by creating a new item on AGOL and then adding that?&lt;BR /&gt;&lt;BR /&gt;I am unable to get the add_layer() method of the WebMap class to work with WFS type items as I get a 'layers' KeyError.&lt;BR /&gt;&lt;BR /&gt;I have tried adding a 'layers' attribute to the object which, interestingly, shows when I use dir() on the object but returns the same KeyError when I try and access item.layers.&lt;BR /&gt;&lt;BR /&gt;Any help appreciated.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2023 14:19:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/adding-wfs-to-webmap-using-python-api/m-p/1325405#M8974</guid>
      <dc:creator>RoryMacGregor</dc:creator>
      <dc:date>2023-09-05T14:19:38Z</dc:date>
    </item>
    <item>
      <title>Re: Adding WFS to webmap using Python API</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/adding-wfs-to-webmap-using-python-api/m-p/1325978#M8981</link>
      <description>&lt;P&gt;Hey Rory,&lt;/P&gt;&lt;P&gt;The add_layer method should be correct for this so it could be a data issue.&lt;/P&gt;&lt;P&gt;Could you check the following guide if you have not already? -&amp;nbsp;&lt;A href="https://developers.arcgis.com/python/samples/publish-ogc-services/" target="_blank"&gt;https://developers.arcgis.com/python/samples/publish-ogc-services/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;If this doesn't help then could you please share your WMS service and I can test on my side.&lt;/P&gt;&lt;P&gt;Many thanks,&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;</description>
      <pubDate>Wed, 06 Sep 2023 16:12:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/adding-wfs-to-webmap-using-python-api/m-p/1325978#M8981</guid>
      <dc:creator>David_McRitchie</dc:creator>
      <dc:date>2023-09-06T16:12:27Z</dc:date>
    </item>
    <item>
      <title>Re: Adding WFS to webmap using Python API</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/adding-wfs-to-webmap-using-python-api/m-p/1328995#M9002</link>
      <description>&lt;P&gt;Hi David,&lt;BR /&gt;&lt;BR /&gt;Thanks for getting back to me.&lt;BR /&gt;&lt;BR /&gt;I have followed that guide and published the WFS using python. That works. However, I cannot then add the published WFS to a webmap using the add_layer method in the Python API. I can add the layer to a webmap using ArcGIS online in the browser but to do this for every webmap we need to update would be very labour intensive.&lt;BR /&gt;&lt;BR /&gt;This is the url for the WFS:&amp;nbsp;&lt;A href="https://api.agrimetrics.co.uk/geoservices/datasets/fb8da72f-4938-4100-ac91-d9b8438ffd4c/wfs?request=getcapabilities" target="_blank"&gt;https://api.agrimetrics.co.uk/geoservices/datasets/fb8da72f-4938-4100-ac91-d9b8438ffd4c/wfs?request=getcapabilities&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;If you could test it and see if you have the same issue, I would be very grateful!&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;Rory&lt;/P&gt;</description>
      <pubDate>Fri, 15 Sep 2023 07:52:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/adding-wfs-to-webmap-using-python-api/m-p/1328995#M9002</guid>
      <dc:creator>RoryMacGregor</dc:creator>
      <dc:date>2023-09-15T07:52:53Z</dc:date>
    </item>
    <item>
      <title>Re: Adding WFS to webmap using Python API</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/adding-wfs-to-webmap-using-python-api/m-p/1330226#M9022</link>
      <description>&lt;P&gt;Hey Rory,&lt;/P&gt;&lt;P&gt;Apologies but checking more into this via the &lt;A href="https://developers.arcgis.com/python/api-reference/arcgis.mapping.toc.html#working-with-ogc-layers" target="_self"&gt;arcgis.mapping.ogc&lt;/A&gt; documentation this will not be supported with wfs layers. Instead it will need to be a WMTS or WMS layer that is used.&lt;/P&gt;&lt;P&gt;I think this would be a good case to raise to ArcGIS Ideas as it might be something that could be included in a future release for the ArcGIS API for Python.&lt;/P&gt;&lt;P&gt;Many thanks,&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Sep 2023 16:16:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/adding-wfs-to-webmap-using-python-api/m-p/1330226#M9022</guid>
      <dc:creator>David_McRitchie</dc:creator>
      <dc:date>2023-09-19T16:16:03Z</dc:date>
    </item>
    <item>
      <title>Re: Adding WFS to webmap using Python API</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/adding-wfs-to-webmap-using-python-api/m-p/1330517#M9028</link>
      <description>&lt;P&gt;Hi David,&lt;BR /&gt;&lt;BR /&gt;Thanks for clarifying this for us, at least we know where we stand. So,&amp;nbsp;As far as you know, there is no way to automate adding wfs data to webmaps using the Python API? I will take your advice and suggest it for a future API update.&lt;BR /&gt;&lt;BR /&gt;Best,&lt;BR /&gt;Rory&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2023 08:53:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/adding-wfs-to-webmap-using-python-api/m-p/1330517#M9028</guid>
      <dc:creator>RoryMacGregor</dc:creator>
      <dc:date>2023-09-20T08:53:41Z</dc:date>
    </item>
    <item>
      <title>Re: Adding WFS to webmap using Python API</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/adding-wfs-to-webmap-using-python-api/m-p/1330703#M9033</link>
      <description>&lt;P&gt;That is correct Rory I do not think this is possible via the Python API, of course, I would love to be proven wrong on this.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2023 16:27:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/adding-wfs-to-webmap-using-python-api/m-p/1330703#M9033</guid>
      <dc:creator>David_McRitchie</dc:creator>
      <dc:date>2023-09-20T16:27:19Z</dc:date>
    </item>
    <item>
      <title>Re: Adding WFS to webmap using Python API</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/adding-wfs-to-webmap-using-python-api/m-p/1538782#M10665</link>
      <description>&lt;P&gt;Well it is possible in ArcGISPro without any python programming. All you do is add a WFS server, tweak the URL, add any cql_filter expressions and get the layers listed. Add these to a map and tweak symbology, visible items and definition queries, layer names etc. Then select all the layers and Share&amp;gt;featurelayer&amp;gt;publish. This will create a better FeatureLayerCollection in AGOL. Why better? Because you can edit, make WebMaps and anything else. The only drawback? It is not dynamic. But wait, neither is WFS usually. The one I have just extracted only updates nightly anyway.&lt;/P&gt;&lt;P&gt;So how can you replicate this in Python. In principle duplicate the steps:&lt;/P&gt;&lt;P&gt;1. Use the requests module to set up a request on the WFS endpoint just like the WFS server&lt;/P&gt;&lt;P&gt;2. Download each sublayer as a json extract and move into a Pandas SpatiallyEnabledDataFrame. Not quite so easy in AGOL because the geopandas module is missing. In principle it should work but is not supported directly. But you can copy a geopandas dataframe to an esri spatialdataframe.&lt;/P&gt;&lt;P&gt;3. upload the sdf to AGOL with the GeoAccessor esri extension to arcgis.&lt;/P&gt;&lt;P&gt;If the WFS data can be queried for changes you could use the gis.content.edit() functions to just add new records. Don't know about delete records.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Sep 2024 05:32:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/adding-wfs-to-webmap-using-python-api/m-p/1538782#M10665</guid>
      <dc:creator>KimOllivier</dc:creator>
      <dc:date>2024-09-16T05:32:01Z</dc:date>
    </item>
    <item>
      <title>Re: Adding WFS to webmap using Python API</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/adding-wfs-to-webmap-using-python-api/m-p/1543631#M10713</link>
      <description>&lt;P&gt;Correction: you cannot hide fields in Pro, they all have to be visible.&lt;/P&gt;</description>
      <pubDate>Sun, 29 Sep 2024 03:04:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/adding-wfs-to-webmap-using-python-api/m-p/1543631#M10713</guid>
      <dc:creator>KimOllivier</dc:creator>
      <dc:date>2024-09-29T03:04:55Z</dc:date>
    </item>
  </channel>
</rss>

