L09_PublishingFeatureLayerFromShapeFile

In [8]:
from arcgis.gis import GIS
gis = GIS("https://www.arcgis.com", "<enter username here>", "<password>")
In [9]:
data = "<file location of zipped Shapefile>"
shpfile = gis.content.add({}, data)
In [10]:
shpfile
Out[10]:
Emergency Response Incidents NYC 4
CSV by BenRamsethEsri5
Last Modified: March 03, 2017
0 comments, 0 views
In [11]:
published_service = shpfile.publish()
In [12]:
display(published_service)
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: NYC_ManhattanCensusTracts_PolygonShapefile',
                                  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')
CensusTracts_item = search_result[0]
map1.add_layer(Response_Incidents_item)
map1
In [ ]: