Select to view content in your preferred language

Import geojson as hosted feature layer

1387
2
Jump to solution
01-31-2022 11:04 AM
ryanh
by
New Contributor II

I am new to ArcGIS. I want to import a geojson file into arcgis as a hosted feature layer.

I am able to do that with GUI.

ryanh_0-1643655456177.png

 

However, I do not know how to do that with arcgis python api. Thank you!!

 

gis = GIS(url=communal_url, username=USERNAME, password=PASSWORD, verify_cert=False)

with open('my.geojson') as data:
    geoData = json.load(data)

empty_service_item = gis.content.create_service(name='test_feature', service_type='featureService')

new_layer= FeatureLayerCollection.fromitem(empty_service_item) 
new_layer.manager.overwrite(geoData)

 

 
0 Kudos
1 Solution

Accepted Solutions
ryanh
by
New Contributor II

Actually, I think I found my answer. 

View solution in original post

0 Kudos
2 Replies
ryanh
by
New Contributor II

Actually, I think I found my answer. 

0 Kudos
ElizabethDonahue
New Contributor III

HI, can you explain how you figured this out?

Thanks, E

0 Kudos