ARCGISSurvey123Connect可以创建要素服务,但只能是托管的要素图层,如何解决这个问题?
创始人
2024-09-12 05:30:30
0

要素服务在ArcGIS Online或ArcGIS Enterprise中托管,因此Survey123 Connect只能创建托管的要素图层。解决这个问题的方法是,使用ArcGIS Online或ArcGIS Enterprise作为托管位置来创建要素服务。以下是一个使用ArcGIS Online作为托管位置的示例代码:

arcpy.CreateFeatureclass_management('C:/data','cities.shp','POINT')
arcpy.AddField_management('cities.shp','NAME','TEXT')
arcpy.AddField_management('cities.shp','POPULATION','LONG')
arcpy.AddField_management('cities.shp','LOCATION','TEXT')
arcpy.AddField_management('cities.shp','COUNTRY','TEXT')
arcpy.AddField_management('cities.shp','POINTS','DOUBLE')
arcpy.AddField_management('cities.shp','TYPE','TEXT')
arcpy.AddField_management('cities.shp','STATUS','TEXT')
arcpy.AddField_management('cities.shp','CREATED_BY','TEXT')

feature_service_url = 'https://.maps.arcgis.com'
username = ''
password = ''

# Sign in to ArcGIS Online
gis = GIS(feature_service_url, username, password)

# Define the feature service name and item components
fs_name = 'myFeatureService'
fs_items = {
    'metadata': {'title': fs_name, 'tags': ['Survey123', 'Python']},
    'data': 'cities.shp',
    'type': 'Shapefile'
}

# Publish the feature service
item_prop = gis.content.add(fs_items['metadata'], fs_items['data'])
fs_item = item_prop.publish()
fs = FeatureLayerCollection.fromitem(fs_item)

# Enable attachments and sync on the feature service
fs.manager.enable_attachments()
fs.manager.sync_enabled(True)

在这个示例代码中,首先创建了一个名为“cities.shp”的要素类。接下来,使用ArcGIS Online作为托管位置来创建要素服务,并定义了要素服务的名称、元数据和数据。最后,使用“FeatureLayerCollection”模块将要素服务

相关内容

热门资讯

透视科技!wpk透视辅助软件,... 透视科技!wpk透视辅助软件,aapoker透视插件,玩家必备攻略(有挂总结)1)wpk透视辅助辅助...
透视实锤!hhpoker辅助软... 透视实锤!hhpoker辅助软件,wepoker底牌透视脚本http,科普攻略(有挂总结)1、上手简...
透视智能ai!hhpoker透... 透视智能ai!hhpoker透视脚本安卓,hhpoker透视功能如何下载,科普常识(有挂方法)1、用...
透视总结!红龙poker脚本,... 透视总结!红龙poker脚本,wepoker透视脚本苹果版,总算了解(有挂详情)1、ai机器人多个强...
透视教程!hhpoker透视脚... 透视教程!hhpoker透视脚本视频,aapoker可以开挂吗,热点讨论(有挂规律);1、完成的残局...
透视总结!aapoker辅助器... 透视总结!aapoker辅助器是真的吗,aapoker辅助器怎么用,推荐一款(有挂介绍);进入游戏-...
透视黑科技!wpk辅助器安装,... 透视黑科技!wpk辅助器安装,hhpoker怎么开透视,避坑细节(有挂辅助挂);1、ai辅助优化,发...
透视中牌率!德普之星透视辅助软... 透视中牌率!德普之星透视辅助软件下载,智星菠萝可以辅助吗,查到实测(有挂攻略)1、系统规律教程、辅助...
透视透视!红龙poker透视,... 透视透视!红龙poker透视,wepoker透视脚本免费,终于清楚(有挂详情)1、操作简单,无需注册...
透视美元局!wepoker底牌... 透视美元局!wepoker底牌透视脚本下载,wepoker透视脚本,最新研发(有挂教程)1、很好的工...