Select to view content in your preferred language

Import geojson as hosted feature layer

1822
2
Jump to solution
01-31-2022 11:04 AM
ryanh
by
Emerging Contributor

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
Emerging Contributor

Actually, I think I found my answer. 

View solution in original post

0 Kudos
2 Replies
ryanh
by
Emerging Contributor

Actually, I think I found my answer. 

0 Kudos
ElizabethDonahue
Regular Contributor

HI, can you explain how you figured this out?

Thanks, E

0 Kudos