L09_PublishingFeatureLayerFromCSV

In [8]:
from arcgis.gis import GIS
gis = GIS("https://www.arcgis.com", "<enter username here>", "<password>")
In [9]:
csv_path = r"<add local path to CSV file>"
csv_properties={'title':'Emergency Response Incidents NYC ',
                'description':'Emergency Response Incidents in Manhattan',
                'tags':'nyc, Emergency Response'}
thumbnail_path = r"C:\ArcGISPythonAPI_Code\emergency_response.jpg"

Emergency_Response_Incidents_csv_item = gis.content.add(item_properties=csv_properties, data=csv_path,
                                     thumbnail = thumbnail_path)
In [10]:
Emergency_Response_Incidents_csv_item
Out[10]:
Emergency Response Incidents NYC 4
CSV by BenRamsethEsri5
Last Modified: March 03, 2017
0 comments, 0 views
In [11]:
Emergency_Response_Incidents_feature_layer_item = Emergency_Response_Incidents_csv_item.publish()
In [12]:
Emergency_Response_Incidents_feature_layer_item
Out[12]:
Emergency Response Incidents NYC 4
Feature Layer Collection by BenRamsethEsri5
Last Modified: March 03, 2017
0 comments, 0 views
In [13]:
search_result = gis.content.search('title:Emergency Response Incidents NYC',
                                  item_type = 'Feature Layer')
search_result
Out[13]:
[<Item title:"Emergency Response Incidents NYC 2" type:Feature Service owner:BenRamsethEsri5>]
In [14]:
map1 = gis.map('New York')
Response_Incidents_item = search_result[0]
map1.add_layer(Response_Incidents_item)
map1
In [ ]: