Hexagon Geospatial
MENU

Developer Discussions

Discuss topics with other Hexagon Geospatial Power Portfolio developers and experts to get the most out of our products.
Showing results for 
Search instead for 
Do you mean 
Reply
Occasional Contributor
Posts: 18
Registered: ‎11-07-2016

Geospatial Portal SDK - Order of WMS/WFS Layers Inconsistent

Hi

 

Using the Geospatial Portal SDK to add WFS and WMS layers with $GP.legend.add. Problem is that the first time the session is run, the layers are not added in the same order as specified in the script. As a result the layers can cover each other in an undesirable manner (e.g. air photo on top of WFS). Is there a way to ensure that the layers will be added in the correct order as specified in the script? I can do a page refresh and the layers come in as expected, but that is a waste of time.

 

Thanks

 

Brad

hbm
Staff
Posts: 285
Registered: ‎11-05-2015

Re: Geospatial Portal SDK - Order of WMS/WFS Layers Inconsistent

[ Edited ]

If my memory doesn't fail me, the order should be consistent as long as you chain $GP.legend.adds so that each subsequent happens in a callback to the previous one. Somewhere along the lines of:

$GP.legend.add({
    definitionName: "WMS",
    url: "http://demo.hexagongeospatial.com/WMS_demo/service.svc/get",
    imageFormat: 0, // PNG
    ids: ["States"] // as value of the "Name" node in GetCapabilities
}, function (result) {
  $GP.legend.add({
      definitionName: "WMS",
      url: "http://demo.hexagongeospatial.com/WMS_demo/service.svc/get",
      imageFormat: 0, // PNG
      ids: ["Rivers"] // as value of the "Name" node in GetCapabilities
  });
});

 

Occasional Contributor
Posts: 18
Registered: ‎11-07-2016

Re: Geospatial Portal SDK - Order of WMS/WFS Layers Inconsistent

That works!

 

Many thanks

 

Brad

Do you need immediate support?
Please submit a Ticket through our
Development Ticket Portal.