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 :
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)
Solved! Go to Solution.
A couple of things to note and try:
web_map_dict['operationalLayers'][0]['url'] = surServcie_item.url + "/" + layer_id
The URL in operationalLayers dictionary should point to a layer in FeatureService. You are pointing to the service directly. Your url should end with layer id, such as 0,1,2 etc
A couple of things to note and try:
web_map_dict['operationalLayers'][0]['url'] = surServcie_item.url + "/" + layer_id
The URL in operationalLayers dictionary should point to a layer in FeatureService. You are pointing to the service directly. Your url should end with layer id, such as 0,1,2 etc
thank you,
You're right !!!
iris
אם את זוכרת אני אמרתי לך באיזה שלב שאת קוראת ל mapservice במקום ל feature service רק שלא ידעתי את הסינטקס המדויק לעשות זאת
מודי
כן נכון שמתי לב .
תודה
בתאריך 13 ביוני 2017 07:30, "Mody Buchbinder" <geonet@esri.com> כתב:
GeoNet <https://community.esri.com/?et=watches.email.thread>
Re: Add Feature Service Item to WebMap
reply from Mody Buchbinder
<https://community.esri.com/people/modybsystematics-co-il-esridist?et=watches.email.thread>
in ArcGIS API for Python - View the full discussion
<https://community.esri.com/message/693335?commentID=693335&et=watches.email.thread#comment-693335>