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
Anonymous
Posts: 0

Portal SDK -- How to programmatically change the visible scale bands for a legend item.

A customer has asked:

 

Is it possible to programmatically change the visible scale bands for a legend item in portal using the Geospatial Portal API?  I am able to programmatically select and zoom to a feature, but if it is out of the display scale range I want to be able to turn on the appropriate display scales for the selected feature's legend item.  The user can do it manually if they know to do that, but I want to automate the process.

Highlighted
Technical Evangelist
Posts: 1,131
Registered: ‎09-11-2015

Re: Portal SDK -- How to programmatically change the visible scale bands for a legend item.

Hi Carolyn,

 

basically it should be possible using internal SDK objects. Unfortunately I don't know the proper way to propagate or force the update of scale bands. This is where I am stuck now:

 

var mapState = $mapStateManager.findMapState("map");
var scaleBands = mapState.get_scaleBands()
scaleBands[1].set_minScaleDenominator(1000000);
mapState.updateScaleBand();

Jan

Jan Neumann
Post Sales Engineer Web Applications
Hexagon Geospatial