This article demonstrates how to add WMS layer in a Map Chart using an Iron Python script.
Introduction
This example illustrates how to add WMS layer in a Map Chart using an Iron Python script.
Code sample
# Copyright © 2017. TIBCO Software Inc. Licensed under TIBCO BSD-style license. from Spotfire.Dxp.Application.Visuals import * from Spotfire.Dxp.Application.Visuals.Maps import * from Spotfire.Dxp.Data import * from System import Uri # sample test url siteUri = Uri("https://idpgis.ncep.noaa.gov/arcgis/services/NWS_Forecasts_Guidance_Warnings/NHC_Atl_trop_cyclones/MapServer/WMSServer?request=GetCapabilities&service=WMS"") page=Document.ActivePageReference for vis in page.Visuals: if vis.TypeId==VisualTypeIdentifiers.MapChart2: map = vis.As[MapChart]() m=map.Layers.AddNewWmsLayer() m.ServiceBaseUri= siteUri m.Sublayers.AddNew("7"," ") # the corresponding name of this layer is 'AT5 Best Wind Radii' in the WMS endpoint XML Schema. #m.AutoConfigure() ######################################### # It may happen that the name displayed in the Properties >> # Layers >>WMS Layer properties is different when you add a layer manually through UI. # You may need to exactly find out what exact XML schema element is used # internally in Spotfire. For this you can get the sublayer names as below. # Manually add the layers through Visualization properties and # run the below script to get the exact names. wmsLayerType= "Spotfire.Dxp.Application.Visuals.Maps.WmsLayer" page=Document.ActivePageReference for vis in page.Visuals: if vis.TypeId==VisualTypeIdentifiers.MapChart2: for layer in vis.As[MapChart]().Layers: if layer.GetType().FullName==wmsLayerType: for value in layer.Sublayers.GetEnumerator(): print value.Name
References
License: TIBCO BSD-Style License
Recommended Comments
There are no comments to display.