I try to append two feature layers in my ArcGIS portal. I'm using arcgis.geoanalytics module to do this. I manage to append these layers without using field mapping, I only pass the input layer and append layer parameter. However, I can't append these layers if I'm using field_mapping parameter. I have read this documentation but there is no example of field_mapping script. https://developers.arcgis.com/python/api-reference/arcgis.geoanalytics.manage_data.html#append-data
Maybe some example of field_mapping parameter would help me. Thank you!
Solved! Go to Solution.
Hi @AriMatiur,
The REST API documentation for the tool outlines the field mapping parameters here. Here is an example:
[
{ "inputLayerField": "Mean_Scales", "mappingType": "AppendField", "mappingValue": "Average_Scales" },
{ "inputLayerField": "Bonus", "mappingType": "Expression", "mappingValue": "$feature['WeeklyRate'] * 1.5" },
{ "inputLayerField": "Errors", "mappingType": "Expression", "mappingValue": "null" }
]
I agree that it's confusing that it's different than expected and then not clearly documented in the ArcGIS API for Python. I've put in a request to have the ArcGIS API for Python documentation include an example.
Please let me know if you have any follow up questions,
Sarah Ambrose
GeoAnalytics Team
I think it may be a list of lists rather than KVPs:
field_mapping = [['kelurahan', 'kelurahan'], ['kecamatan','kecamatan']]
Hello David
It still not working
Yeh I only came across that type of field mapping in another Python API tool, was worth a go I guess.
This tool's documentation for the field_mapping parameter is awful.
Yeah, other Python API tool field_mapping use list or KVPs. I don't know why this one is different.
Anyway, thank you very much.
Hi @AriMatiur,
The REST API documentation for the tool outlines the field mapping parameters here. Here is an example:
[
{ "inputLayerField": "Mean_Scales", "mappingType": "AppendField", "mappingValue": "Average_Scales" },
{ "inputLayerField": "Bonus", "mappingType": "Expression", "mappingValue": "$feature['WeeklyRate'] * 1.5" },
{ "inputLayerField": "Errors", "mappingType": "Expression", "mappingValue": "null" }
]
I agree that it's confusing that it's different than expected and then not clearly documented in the ArcGIS API for Python. I've put in a request to have the ArcGIS API for Python documentation include an example.
Please let me know if you have any follow up questions,
Sarah Ambrose
GeoAnalytics Team