AnsweredAssumed Answered

Add Feature Service Item to WebMap

Question asked by birdface on Jun 6, 2017
Latest reply on Jun 12, 2017 by birdface

Hi’

I have followed the example notebook “Publish WebMap” and tried to add Feature Service Item to my web map.

The Script works fine only the Layer does not show in the map.

When I add the same layer Item manually it was working fine.

I have followed this suggesting

your_web_map_obj['operationalLayers'][0]['layerDefinition']['drawingInfo']['renderer']

from URL :

https://community.esri.com/thread/193550-web-map-created-with-python-api-and-feature-services-not-displaying-features#comment-680511

but it is not working.

Does anyone knows what am I doing wrong?

 

thanks iris

 

This is the whole script:

from arcgis.gis import *
import os
import json
from IPython.display import display
gis = GIS("URL","USER","PW")
surServcie_properties={'title':'testing iris item',
'description':'testing adding new item by script',
'tags':'python,test','type':'Feature Service','url':'http://HOSTNAME/FOLDER/rest/services/TestSurIris/FeatureServer'}

surServcie_item = gis.content.add(item_properties=surServcie_properties,
thumbnail = None)

web_map_dict = dict()
with open("C:\\Temp\\base.json","r") as file_handle:
web_map_dict = json.load(file_handle)
web_map_dict['operationalLayers'][0]['itemId'] = surServcie_item.itemid
web_map_dict['operationalLayers'][0]['layerType'] = "ArcGISFeatureServiceLayer"
web_map_dict['operationalLayers'][0]['title'] = surServcie_item.title
web_map_dict['operationalLayers'][0]['url'] = surServcie_item.url
web_map_dict['operationalLayers'][0]['layerDefinition'] = '{"drawingInfo":{"renderer":{"type":"simple","label":"","description":"","symbol":{"color":[133,0,11,255],"size":4,"angle":0,"xoffset":0,"yoffset":0,"type":"esriSMS","style":"esriSMSCircle","outline":{"color":[0,0,0,255],"width":1,"type":"esriSLS","style":"esriSLSSolid"}}}}}'
display(web_map_dict)

web_map_properties = {'title':'SurveyColector test map',
'type':'Web Map',
'snippet':'This map to be used in the collector ',
'tags':'python',
'text':json.dumps(web_map_dict)}
# Call the add() with web map item's properties and content.
web_map_item = gis.content.add(web_map_properties)

Outcomes