<?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: Can you not use gis.content.add() with *.shp but only *.zip? in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/can-you-not-use-gis-content-add-with-shp-but-only/m-p/780074#M1154</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Makes sense to me since the shp portion of a shapefile is only one component.&amp;nbsp; zipping the 'shapefile' makes sure all the bits are moved on&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 26 Jan 2019 01:03:19 GMT</pubDate>
    <dc:creator>DanPatterson_Retired</dc:creator>
    <dc:date>2019-01-26T01:03:19Z</dc:date>
    <item>
      <title>Can you not use gis.content.add() with *.shp but only *.zip?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/can-you-not-use-gis-content-add-with-shp-but-only/m-p/780073#M1153</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I&amp;nbsp;was reading the following as a convenience feature:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;EM&gt;&lt;SPAN style="color: #4c4c4c; background-color: #ffffff;"&gt;If you have a small amount of data in a shapefile, you can make it available for others to view through a web browser by adding it as a&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="" style="background-color: #ffffff; font-size: 17px;"&gt;.zip&lt;/SPAN&gt;&lt;SPAN style="color: #4c4c4c; background-color: #ffffff;"&gt;&amp;nbsp;file containing the&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="" style="background-color: #ffffff; font-size: 17px;"&gt;.shp&lt;/SPAN&gt;&lt;SPAN style="color: #4c4c4c; background-color: #ffffff;"&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="" style="background-color: #ffffff; font-size: 17px;"&gt;.shx&lt;/SPAN&gt;&lt;SPAN style="color: #4c4c4c; background-color: #ffffff;"&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="" style="background-color: #ffffff; font-size: 17px;"&gt;.dbf&lt;/SPAN&gt;&lt;SPAN style="color: #4c4c4c; background-color: #ffffff;"&gt;, and&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="" style="background-color: #ffffff; font-size: 17px;"&gt;.prj&lt;/SPAN&gt;&lt;SPAN style="color: #4c4c4c; background-color: #ffffff;"&gt;&amp;nbsp;files to a map you create with&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4c4c4c; background-color: #ffffff;"&gt;Map Viewer&lt;/SPAN&gt;&lt;SPAN style="color: #4c4c4c; background-color: #ffffff;"&gt;.&amp;nbsp;&lt;A class="link-titled" href="http://enterprise.arcgis.com/en/portal/latest/use/shapefiles.htm#ESRI_SECTION1_5C09FDA5EA5A4D3595652B25F892A1C1" title="http://enterprise.arcgis.com/en/portal/latest/use/shapefiles.htm#ESRI_SECTION1_5C09FDA5EA5A4D3595652B25F892A1C1" rel="nofollow noopener noreferrer" target="_blank"&gt;Shapefiles—Portal for ArcGIS | ArcGIS Enterprise&lt;/A&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/EM&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;But it looks like the following really doesn't work:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;county_properties = {'title':'Active Counties',
 &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;&amp;nbsp;'tags':'counties, rigs, portal upload test',
 &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;&amp;nbsp;'type':'Shapefile'}
counties_shp = mygis.content.add(county_properties, data='c:/temp/counties.shp')
&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&lt;SPAN style="color: #ff0000;"&gt;Error while analyzing Shapefile 'counties.shp' Invalid Shapefile&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Then, however, I can do this:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import zipfile
import glob, os

shpDir = 'c:/temp'
nametrunc = 'counties*'

files = glob.glob(os.path.join(shpDir,nametrunc))

with zipfile.ZipFile(os.path.join(shpDir,'counties.zip'), 'w') as myzip:
&amp;nbsp; &amp;nbsp;for file in files:
&amp;nbsp; &amp;nbsp; &amp;nbsp;myzip.write(file)

counties_shp = mygis.content.add(county_properties, data='c:/temp/counties.zip')&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I haven't had to upload a bunch of SHP files to Portal but it sure would be easier if you&amp;nbsp;didn't have to zip them up.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 08:48:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/can-you-not-use-gis-content-add-with-shp-but-only/m-p/780073#M1153</guid>
      <dc:creator>Arne_Gelfert</dc:creator>
      <dc:date>2021-12-12T08:48:29Z</dc:date>
    </item>
    <item>
      <title>Re: Can you not use gis.content.add() with *.shp but only *.zip?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/can-you-not-use-gis-content-add-with-shp-but-only/m-p/780074#M1154</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Makes sense to me since the shp portion of a shapefile is only one component.&amp;nbsp; zipping the 'shapefile' makes sure all the bits are moved on&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 26 Jan 2019 01:03:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/can-you-not-use-gis-content-add-with-shp-but-only/m-p/780074#M1154</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2019-01-26T01:03:19Z</dc:date>
    </item>
  </channel>
</rss>

