07-10-2018 07:37 AM
Hello,
We add a WMS layer programatically in GeoMedia.
It is displayed well when GWS csf is 4326. The legend entry is not displayed when changing GWS csf to another EPSG (supported by the service).
By adding the WMS layer manually by right clic on the legend, no problem.
Do we missed something in the simple code bellow?
Thank you for your help!
Yohann.
// Create originating pipe using WMS connection -------------------------------
connection.CreateOriginatingPipe(out pipe);
// Set table as WMS layer name -----------------------------------------------------
pipe.Table = WMSlayer;
// Get recordset --------------------------------------------------------------------------
rs = pipe.OutputRecordset;
// Set legend entry and add to legend entries ------------------------------------
legendEntry.InputRecordset = (Intergraph.GeoMedia.GDO.GRecordset)rs;
legendEntry.Name = WMSlayer;
legendEntry.GeometryFieldName = "Geometry";
legend.LegendEntries.Append(legendEntry);
gMProperty = (Intergraph.GeoMedia.PDBPipe.GMProperty)application.CreateService("GeoMedia.GMProperty");
gMProperty.Name = "Title";
gMProperty.Value = WMSlayer;
legendEntry.PropertySet.Append(gMProperty);
// Set legend entry style as image ---------------------------------------------------
l_ssStyleService = (Intergraph.GeoMedia.PView.StyleService)application.CreateService("Geomedia.StyleService");
l_ssStyleService.GetStyle("Image Style", out l_sdStyle);
legendEntry.Style = l_sdStyle;
// Load data --------------------------------------------------------------------------------
legendEntry.LoadData(true);
Solved! Go to Solution.
07-10-2018 07:59 AM
Hi Yohann,
yes, you missed basically two steps:
Then it should start to work. Let me know if you need more details.
Pavel
07-10-2018 08:22 AM
Hello Pavel,
Using a CSSTransformPipe as you said solves the problem. Thank you!
I didn't add the query to subfolders. Is it required? Can this lead to errors?
Thank you very much!
Yohann.
07-10-2018 08:33 AM
Hi Yohann,
it is good to populate the QueryFolder so that your code is compatible with GM framework. I am not sure what consequences not adding the query might have. Maybe when saving and opening the gws. But you will see, if some problems occur, you know where the problem might be.
Pavel
07-10-2018 08:36 AM
Perfect, thank you Pavel!