<?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: Extracting id from MapView Object and then Making this Map available for everyone to view in Python. in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/extracting-id-from-mapview-object-and-then-making/m-p/1043865#M39317</link>
    <description>&lt;P&gt;I tried this:&lt;/P&gt;&lt;PRE&gt;map_id = g.content.search(&lt;SPAN&gt;'2020#156'&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;item_type&lt;/SPAN&gt;=&lt;SPAN&gt;'Web Map'&lt;/SPAN&gt;)[&lt;SPAN&gt;0&lt;/SPAN&gt;].id&lt;BR /&gt;g.content.search(&lt;SPAN&gt;'2020#156'&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;item_type&lt;/SPAN&gt;=&lt;SPAN&gt;'Web Map'&lt;/SPAN&gt;)[&lt;SPAN&gt;0&lt;/SPAN&gt;].share(&lt;SPAN&gt;everyone&lt;/SPAN&gt;=&lt;SPAN&gt;True&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;P&gt;IndexError: list index out of range&lt;/P&gt;&lt;P&gt;The search comes up empty. However, it is in my contents (see image)&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 05 Apr 2021 17:11:25 GMT</pubDate>
    <dc:creator>findyourinvasive</dc:creator>
    <dc:date>2021-04-05T17:11:25Z</dc:date>
    <item>
      <title>Extracting id from MapView Object and then Making this Map available for everyone to view in Python.</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/extracting-id-from-mapview-object-and-then-making/m-p/1043803#M39313</link>
      <description>&lt;P&gt;Here is the code I have so far. I am using the ArcGIS Python API.&lt;/P&gt;&lt;PRE&gt;g = GIS(&lt;SPAN&gt;"https://www.arcgis.com"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"USERNAME"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"PASSWORD"&lt;/SPAN&gt;)&lt;BR /&gt;&lt;BR /&gt;p = {&lt;BR /&gt;     &lt;SPAN&gt;'type'&lt;/SPAN&gt;:&lt;SPAN&gt;"CSV"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;     &lt;SPAN&gt;'title'&lt;/SPAN&gt;: &lt;SPAN&gt;'2020#12'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;     &lt;SPAN&gt;'snippet'&lt;/SPAN&gt;:&lt;SPAN&gt;'hwa'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;     &lt;SPAN&gt;'description'&lt;/SPAN&gt;:&lt;SPAN&gt;'test ' &lt;/SPAN&gt;+ \&lt;BR /&gt;     &lt;SPAN&gt;'dataframe object to a GIS item'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;     &lt;SPAN&gt;'tags'&lt;/SPAN&gt;: &lt;SPAN&gt;'python'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;     }&lt;BR /&gt;&lt;BR /&gt;i=g.content.add (&lt;SPAN&gt;item_properties&lt;/SPAN&gt;=p&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;                 &lt;SPAN&gt;data&lt;/SPAN&gt;=&lt;SPAN&gt;"C:/Users/NAME/PycharmProjects/colors/Map/5TXHV8NTC5.csv"&lt;BR /&gt;&lt;/SPAN&gt;                 )&lt;BR /&gt;q=i.publish ()&lt;BR /&gt;&lt;SPAN&gt;print &lt;/SPAN&gt;(q)&lt;BR /&gt;search = g.content.search(&lt;SPAN&gt;query&lt;/SPAN&gt;=&lt;SPAN&gt;"owner:USERNAME"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;                                   &lt;SPAN&gt;item_type&lt;/SPAN&gt;=&lt;SPAN&gt;"Feature Layer"&lt;/SPAN&gt;)&lt;BR /&gt;&lt;SPAN&gt;print &lt;/SPAN&gt;(search)&lt;BR /&gt;&lt;SPAN&gt;from &lt;/SPAN&gt;arcgis.mapping &lt;SPAN&gt;import &lt;/SPAN&gt;WebMap&lt;BR /&gt;&lt;SPAN&gt;#map = WebMap()&lt;BR /&gt;&lt;/SPAN&gt;map=g.map (&lt;SPAN&gt;location&lt;/SPAN&gt;=&lt;SPAN&gt;"United States"&lt;/SPAN&gt;)&lt;BR /&gt;item=search [&lt;SPAN&gt;0&lt;/SPAN&gt;]&lt;BR /&gt;&lt;SPAN&gt;print &lt;/SPAN&gt;(item)&lt;BR /&gt;map.add_layer(item)&lt;BR /&gt;props={&lt;SPAN&gt;'title'&lt;/SPAN&gt;: &lt;SPAN&gt;'2020#156'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;     &lt;SPAN&gt;'snippet'&lt;/SPAN&gt;:&lt;SPAN&gt;'hwa'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;     &lt;SPAN&gt;'tags'&lt;/SPAN&gt;: &lt;SPAN&gt;'python'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;     &lt;SPAN&gt;"renderer"&lt;/SPAN&gt;:&lt;SPAN&gt;"autocast"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;     &lt;SPAN&gt;"field_name"&lt;/SPAN&gt;: &lt;SPAN&gt;"Threat"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;     }&lt;BR /&gt;map.save (props)&lt;/PRE&gt;&lt;P&gt;1. I realize that I can get the id for the MapView object from the url. However, is there a way I can get this id from Python?&lt;/P&gt;&lt;P&gt;2. When I try an embed my map in my website, credentials are requested. I would like everyone to be able to view my map. Is there a way I can configure sharing privileges for my map from Python?&lt;/P&gt;</description>
      <pubDate>Mon, 05 Apr 2021 16:08:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/extracting-id-from-mapview-object-and-then-making/m-p/1043803#M39313</guid>
      <dc:creator>findyourinvasive</dc:creator>
      <dc:date>2021-04-05T16:08:53Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting id from MapView Object and then Making this Map available for everyone to view in Python.</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/extracting-id-from-mapview-object-and-then-making/m-p/1043853#M39314</link>
      <description>&lt;P&gt;The &lt;STRONG&gt;MapView&lt;/STRONG&gt; object may reference the web map, but is not the web map itself, so it won't have direct access to the id. Instead, you'll need to return the &lt;STRONG&gt;Item&lt;/STRONG&gt;. You can pass the title you defined back into another query and get the ID that way.&lt;/P&gt;&lt;PRE&gt;map_id = g.content.search('new-title', item_type='Web Map')[0].id&lt;/PRE&gt;&lt;P&gt;Sharing is likewise defined&lt;A href="https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#arcgis.gis.Item.share" target="_self"&gt; at the&amp;nbsp;&lt;STRONG&gt;Item&lt;/STRONG&gt; level.&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;g.content.search('new-title', item_type='Web Map')[0].share(everyone=True)&lt;/PRE&gt;</description>
      <pubDate>Mon, 05 Apr 2021 16:55:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/extracting-id-from-mapview-object-and-then-making/m-p/1043853#M39314</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2021-04-05T16:55:02Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting id from MapView Object and then Making this Map available for everyone to view in Python.</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/extracting-id-from-mapview-object-and-then-making/m-p/1043865#M39317</link>
      <description>&lt;P&gt;I tried this:&lt;/P&gt;&lt;PRE&gt;map_id = g.content.search(&lt;SPAN&gt;'2020#156'&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;item_type&lt;/SPAN&gt;=&lt;SPAN&gt;'Web Map'&lt;/SPAN&gt;)[&lt;SPAN&gt;0&lt;/SPAN&gt;].id&lt;BR /&gt;g.content.search(&lt;SPAN&gt;'2020#156'&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;item_type&lt;/SPAN&gt;=&lt;SPAN&gt;'Web Map'&lt;/SPAN&gt;)[&lt;SPAN&gt;0&lt;/SPAN&gt;].share(&lt;SPAN&gt;everyone&lt;/SPAN&gt;=&lt;SPAN&gt;True&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;P&gt;IndexError: list index out of range&lt;/P&gt;&lt;P&gt;The search comes up empty. However, it is in my contents (see image)&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Apr 2021 17:11:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/extracting-id-from-mapview-object-and-then-making/m-p/1043865#M39317</guid>
      <dc:creator>findyourinvasive</dc:creator>
      <dc:date>2021-04-05T17:11:25Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting id from MapView Object and then Making this Map available for everyone to view in Python.</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/extracting-id-from-mapview-object-and-then-making/m-p/1043869#M39319</link>
      <description>&lt;P&gt;I converted the map to a web map and it worked perfectly. Thank you.&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;from &lt;/SPAN&gt;arcgis.mapping &lt;SPAN&gt;import &lt;/SPAN&gt;WebMap&lt;BR /&gt;map = WebMap()&lt;/PRE&gt;&lt;P&gt;I also did&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;time.sleep(&lt;SPAN&gt;5&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;P&gt;It takes some time to update.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Apr 2021 17:24:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/extracting-id-from-mapview-object-and-then-making/m-p/1043869#M39319</guid>
      <dc:creator>findyourinvasive</dc:creator>
      <dc:date>2021-04-05T17:24:01Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting id from MapView Object and then Making this Map available for everyone to view in Python.</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/extracting-id-from-mapview-object-and-then-making/m-p/1043870#M39320</link>
      <description>&lt;P&gt;Great! I have noticed that searching for content can treat the '#' character differently, so perhaps that was involved. But as long as it's working!&lt;/P&gt;</description>
      <pubDate>Mon, 05 Apr 2021 17:24:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/extracting-id-from-mapview-object-and-then-making/m-p/1043870#M39320</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2021-04-05T17:24:09Z</dc:date>
    </item>
  </channel>
</rss>

