How to get service sublayer name from SOI (10.7.1 Java)?

1258
2
Jump to solution
10-30-2020 02:43 PM
AdamMesser
New Contributor II

Is there a way to retrieve the name of the specific sublayer of the service the SOI is receiving a request for through the Java SDK? The handleRESTRequest function takes the resourceName parameter which specifies the sublayer index (i.e. ‘layers/23’) of the request. How can I retrieve the title of that sublayer as a string?

0 Kudos
1 Solution

Accepted Solutions
by Anonymous User
Not applicable

You can get the layer name from IMapLayerInfo.getName(). 

IMapServer ms=(IMapServer)this.soHelper.getServerObject();

IMapServerInfo mapServerInfo = ms.getServerInfo(ms.getDefaultMapName());

IMapLayerInfos layerInfos = mapServerInfo.getMapLayerInfos();

Loop through the IMapLayerInfos and you can find each layer's layer ID (IMapLayerInfo.getID()) and layer name (IMapLayerInfo.getName()). Based on the ID-Name pairs, you can return the layer name given the ID/index from the resourceName for each request.

View solution in original post

2 Replies
by Anonymous User
Not applicable

You can get the layer name from IMapLayerInfo.getName(). 

IMapServer ms=(IMapServer)this.soHelper.getServerObject();

IMapServerInfo mapServerInfo = ms.getServerInfo(ms.getDefaultMapName());

IMapLayerInfos layerInfos = mapServerInfo.getMapLayerInfos();

Loop through the IMapLayerInfos and you can find each layer's layer ID (IMapLayerInfo.getID()) and layer name (IMapLayerInfo.getName()). Based on the ID-Name pairs, you can return the layer name given the ID/index from the resourceName for each request.

AdamMesser
New Contributor II

@Anonymous User Thanks much for your  feedback! We were able to successfully get those suggestions implemented.

0 Kudos