0

I created a custom print service using ArcPy. It is hosted as GPServer on my test server. The print service uses a JSON configuration file to pull the data from the mxd. The JSON passed from the web application to replace various text elements. However, I am bit stuck on how display the Legend using the JSON passed from the web map. I have a Legend element in my MXD called "Route_Legend".

In this example, I have this json sent to the print service

layout_Options: {
    'legendOptions ': {
        'operationalLayers': [{
                'id ': 'WV_Base_Route_Webmap_022019_Comments_1982'
            }
        ]
    },
    'copyrightText ': 'County of Los Angeles, Bureau of Land Management, Esri, HERE, Garmin, INCREMENT P, USGS, METI/NASA, EPA, USDA | VENOM',
    'scaleBarOptions ': {
        'nonMetricUnit': 'esriMiles',
        'nonMetricLabel': 'mi ',
        ' metricUnit ': ' esriKilometers ',
        'metricLabel': 'km '
    },
    'customTextElements': [{
            ' Date ': ' 3 / 5 / 2019, 9: 02: 34 AM'
        }
    ],
    ' authorText ': ' Web AppBuilder for ArcGIS ',
    ' titleText ': 'TEST '
}

How do you pull the legend data into your output?

I work with PDFs most of the time. I have done my research online and I didn't find one that uses a JSON configuration file. The JSON configuration file looks like this:

{
  "layer_title": "Route_Title",
  "district_fld": "District",
  "scenario_fld": "Scenario",
  "version_fld": "Version",
  "cis_link_id_fld": "CISLINKID",
  "map_title_fld": "Map_Title",
  "out_flds": "District,Scenario,Version,Map_Title,CISLINKID",
  "title_element_text": "Route Number",
  "district_element_text": "District",
  "scenario_element_text": "Scenario: XX",
  "version_element_text": "Version: XX"
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.