I'm new to the Java runtime. I'm trying to get the extent for each sublayer which I assumed would be available by calling
getMapServiceSublayerInfo().getExtent() butgetMapServiceSublayerInfo()
always returns null.
I've tried with our map service and the ESRI sample service
http://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer Guidance would be much appreciated. Jack
Hi Jack: You are explicitly loading the `ArcGISMapImageLayer` but not the sublayer.
ArcGISMapImageLayer mapImageLayer <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">ArcGISMapImageLayer</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token"><SPAN>"</SPAN><A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=http%3A%2F%2Fsampleserver6.arcgisonline.com%2Farcgis%2Frest%2Fservices%2FUSA%2FMapServer" target="_blank">http://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer</A><SPAN>"</SPAN></SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> mapImageLayer<SPAN class="punctuation token">.</SPAN><SPAN class="token function">loadAsync</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> mapImageLayer<SPAN class="punctuation token">.</SPAN><SPAN class="token function">addDoneLoadingListener</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">-</SPAN><SPAN class="operator token">></SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="keyword token">final</SPAN> ArcGISMapImageSublayer testSublayer <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">(</SPAN>ArcGISMapImageSublayer<SPAN class="punctuation token">)</SPAN> mMapImageLayer<SPAN class="punctuation token">.</SPAN><SPAN class="token function">getSublayers</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="token function">get</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> testSublayer<SPAN class="punctuation token">.</SPAN><SPAN class="token function">loadAsync</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> testSublayer<SPAN class="punctuation token">.</SPAN><SPAN class="token function">addDoneLoadingListener</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">-</SPAN><SPAN class="operator token">></SPAN> <SPAN class="punctuation token">{</SPAN> ArcGISMapServiceSublayerInfo testInfo <SPAN class="operator token">=</SPAN> testSublayer<SPAN class="punctuation token">.</SPAN><SPAN class="token function">getMapServiceSublayerInfo</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.