<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Offline Map doesn't show all layers in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/offline-map-doesn-t-show-all-layers/m-p/1014891#M35786</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; I'm new to The Esri Community and Android SDK programming. &amp;nbsp;I'm having an issue where I need to offline a section of the map as outlined in this tutorial -&amp;nbsp;&lt;A href="https://developers.arcgis.com/android/latest/guide/take-map-offline-on-demand.htm" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/android/latest/guide/take-map-offline-on-demand.htm&lt;/A&gt;&amp;nbsp;but I'm using inherited code outlined below to do so and the output map doesn't show all of the layers of the maps and throws an exception:&lt;/P&gt;&lt;P&gt;I/System.out: Non Outage Completion cannot be taken offline&lt;BR /&gt;Error : com.esri.arcgisruntime.ArcGISRuntimeException: Illegal state: Unable to support duplicate feature layers already exists&lt;/P&gt;&lt;P&gt;I use this code to generate the map and the exception:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="kotlin"&gt;    fun generateOfflineMap() {
        // create a progress dialog to show map download progress
        progressDialog!!.setTitle("Generate Offline Map")
        progressDialog!!.setMessage("Downloading map...")
        progressDialog!!.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL)
        progressDialog!!.isIndeterminate = false
        progressDialog!!.setCanceledOnTouchOutside(false)
        progressDialog!!.setButton(DialogInterface.BUTTON_NEGATIVE, "Cancel") { dialog, which -&amp;gt;
            downloadMsg!!.visibility = View.GONE
            mGraphicsOverlay!!.graphics.clear()
            mapdownloadJob!!.cancel()
            //set the flag to false to re-select the download area for consecutive downloads
            isMapDownloadAreaSelected = false
            isMapDownloadInProgress = false
            dialog.dismiss()
        }
        if (!isMapDownloadAreaSelected) {
            downloadMsg!!.visibility = View.VISIBLE
            // create a graphics overlay for the map view
            mGraphicsOverlay = GraphicsOverlay()
            mapView!!.graphicsOverlays.add(mGraphicsOverlay)

            // create a graphic to show a box around the extent we want to download
            mDownloadArea = Graphic()
            mGraphicsOverlay!!.graphics.add(mDownloadArea)
            val simpleLineSymbol = SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, Color.RED, 2F)
            mDownloadArea!!.symbol = simpleLineSymbol
            // upper left corner of the area to take offline
            minScreenPoint = Point(200, 200)
            // lower right corner of the downloaded area
            maxScreenPoint = Point(mapView!!.width - 200,
                    mapView!!.height - 200)
            // convert screen points to map points
            minPoint = mapView!!.screenToLocation(minScreenPoint)
            maxPoint = mapView!!.screenToLocation(maxScreenPoint)
            // use the points to define and return an envelope
            if (minPoint != null &amp;amp;&amp;amp; maxPoint != null) {
                val envelope = Envelope(minPoint, maxPoint)
                mDownloadArea!!.geometry = envelope
            }

            //Debugging - use this to get errors with layers and tables

            var offlineMapTask = OfflineMapTask(map);
            var minScale = mapView!!.mapScale
            val maxScale = mapView!!.map.maxScale
            val generateOfflineMapParameters = GenerateOfflineMapParameters(mDownloadArea!!.geometry, minScale, maxScale)

            val offlineMapCapabilitiesFuture: ListenableFuture&amp;lt;OfflineMapCapabilities&amp;gt; = offlineMapTask.getOfflineMapCapabilitiesAsync(generateOfflineMapParameters)
            offlineMapCapabilitiesFuture.addDoneListener {
                    val offlineMapCapabilities: OfflineMapCapabilities = offlineMapCapabilitiesFuture.get()
                    if (offlineMapCapabilities.hasErrors()) {
                        // Handle possible errors with layers
                        for ((key, value) in offlineMapCapabilities.getLayerCapabilities()) {
                            if (!value.isSupportsOffline()) {
                                println(key.getName().toString() + " cannot be taken offline\n" +
                                        "Error: " + value.getError())
                            }
                        }

                        // Handle possible errors with tables
                        for ((key, value) in offlineMapCapabilities.getTableCapabilities()) {
                            if (!value.isSupportsOffline()) {
                                println(key.tableName.toString() + " cannot be taken offline\n" +
                                        "Error : " + value.getError())
                            }
                        }
                    } else {
                        // All layers and tables can be taken offline!
                        showMessage("All layers are good to go!")
                    }
            }

            //End Debugging

            // update the download area box whenever the viewpoint changes
            mapView!!.addViewpointChangedListener { viewpointChangedEvent: ViewpointChangedEvent? -&amp;gt;
                if (map!!.loadStatus == LoadStatus.LOADED) {
                    // upper left corner of the area to take offline
                    minScreenPoint = Point(200, 200)
                    // lower right corner of the downloaded area
                    maxScreenPoint = Point(mapView!!.width - 200,
                            mapView!!.height - 200)
                    // convert screen points to map points
                    minPoint = mapView!!.screenToLocation(minScreenPoint)
                    maxPoint = mapView!!.screenToLocation(maxScreenPoint)
                    // use the points to define and return an envelope
                    if (minPoint != null &amp;amp;&amp;amp; maxPoint != null) {
                        val envelope = Envelope(minPoint, maxPoint)
                        mDownloadArea!!.geometry = envelope
                    }
                }
            }
            // map download area selected
            isMapDownloadAreaSelected = true
        } else {
            if (!isMapDownloadInProgress) {
                progressDialog!!.progress = 0
                progressDialog!!.show()

                // delete any offline map already in the cache
                deleteDirectory(File(offlineMapDirectoryPath))
                // specify the extent, min scale, and max scale as parameters
                var minScale = mapView!!.mapScale
                val maxScale = mapView!!.map.maxScale
                // minScale must always be larger than maxScale
                if (minScale &amp;lt;= maxScale) {
                    minScale = maxScale + 1
                }
                val generateOfflineMapParameters = GenerateOfflineMapParameters(mDownloadArea!!.geometry, minScale, maxScale)
                // create an offline map offlineMapTask with the map
                val offlineMapTask = OfflineMapTask(mapView!!.map)

                // create an offline map job with the download directory path and parameters and start the job
                mapdownloadJob = offlineMapTask.generateOfflineMap(generateOfflineMapParameters, offlineMapDirectoryPath)
                isMapDownloadInProgress = true
                // replace the current map with the result offline map when the job finishes
                mapdownloadJob.addJobDoneListener(Runnable {
                    if (mapdownloadJob.getStatus() == Job.Status.SUCCEEDED) {
                        val result = mapdownloadJob.getResult()
                        downloadMsg!!.visibility = View.GONE
                        mGraphicsOverlay!!.graphics.clear()
                        //set the flag to false to re-select the download area for consecutive downloads
                        isMapDownloadAreaSelected = false
                        isMapDownloadInProgress = false

                        //show the map
                        mapView!!.map = result.offlineMap

                        //hide save map, show cancel map
                        //save_map.visibility = View.GONE
                        //cancel_map.visibility = View.VISIBLE

                        //hide the legend - it must be online
                        legendHeader!!.visibility = View.GONE

                        if (mAttributes != null) {
                            sharedPreferencesPseg.setString("ESDNUMBERFORSAVEDMAP", mAttributes!!.cadjobno)
                        } else {
                            sharedPreferencesPseg.setString("ESDNUMBERFORSAVEDMAP", "MAINTAB")
                        }

                        Toast.makeText(requireContext(), "Map downloaded successfully", Toast.LENGTH_LONG).show()
                    } else if (mapdownloadJob.getStatus() == Job.Status.FAILED) {
                        Toast.makeText(requireContext(), "Error in generate offline map", Toast.LENGTH_LONG).show()
                    } else if (mapdownloadJob.getStatus() == Job.Status.PAUSED) {
                        Toast.makeText(requireContext(), "Map download cancelled", Toast.LENGTH_LONG).show()
                    }
                    progressDialog!!.dismiss()
                })
                mapdownloadJob.addProgressChangedListener(Runnable { progressDialog!!.progress = mapdownloadJob.getProgress() })
                mapdownloadJob.start()
            } else {
                mapdownloadJob!!.addProgressChangedListener { progressDialog!!.progress = mapdownloadJob!!.progress }
                progressDialog!!.show()
            }
        }
    }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; When the code to display the map is called the map is displayed but with minimal detail and it appears layer(s) are left out. &amp;nbsp;I'm not sure what is causing this. &amp;nbsp;I also use this function below to open the map and wanted to provide this to see if there are errors in this code as well:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="kotlin"&gt;    private fun openOfflineMap() {
        val offlineMapPackage = MobileMapPackage(offlineMapDirectoryPath)
        offlineMapPackage.loadAsync()
        offlineMapPackage.addDoneLoadingListener {
            if (offlineMapPackage.maps.size == 0) {
                mapNotDownloadedMsg!!.visibility = View.VISIBLE
                progressBar!!.visibility = View.GONE
            } else {
                mapView!!.map = offlineMapPackage.maps[0]
                callout = mapView!!.callout
                progressBar!!.visibility = View.GONE
                //                    downloadMapIcon.setVisibility(View.GONE);
                mapView!!.visibility = View.VISIBLE
                mapView!!.onTouchListener = object : DefaultMapViewOnTouchListener(context, mapView) {
                    override fun onSingleTapConfirmed(e: MotionEvent): Boolean {
                        if (callout.isShowing()) {
                            callout.dismiss()
                        }
                        val screenPoint = Point(Math.round(e.x), Math.round(e.y))
                        // identifyResult(screenPoint);
                        identifyandDisplayResults(screenPoint)
                        return true
                    }
                }
            }
        }
    }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help you can provide is much appreciated! &amp;nbsp;If there is a need for additional detail please let me know and I will provide as best I can.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;John Meah&lt;/P&gt;</description>
    <pubDate>Thu, 07 Jan 2021 22:12:12 GMT</pubDate>
    <dc:creator>JohnMeah</dc:creator>
    <dc:date>2021-01-07T22:12:12Z</dc:date>
    <item>
      <title>Offline Map doesn't show all layers</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/offline-map-doesn-t-show-all-layers/m-p/1014891#M35786</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; I'm new to The Esri Community and Android SDK programming. &amp;nbsp;I'm having an issue where I need to offline a section of the map as outlined in this tutorial -&amp;nbsp;&lt;A href="https://developers.arcgis.com/android/latest/guide/take-map-offline-on-demand.htm" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/android/latest/guide/take-map-offline-on-demand.htm&lt;/A&gt;&amp;nbsp;but I'm using inherited code outlined below to do so and the output map doesn't show all of the layers of the maps and throws an exception:&lt;/P&gt;&lt;P&gt;I/System.out: Non Outage Completion cannot be taken offline&lt;BR /&gt;Error : com.esri.arcgisruntime.ArcGISRuntimeException: Illegal state: Unable to support duplicate feature layers already exists&lt;/P&gt;&lt;P&gt;I use this code to generate the map and the exception:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="kotlin"&gt;    fun generateOfflineMap() {
        // create a progress dialog to show map download progress
        progressDialog!!.setTitle("Generate Offline Map")
        progressDialog!!.setMessage("Downloading map...")
        progressDialog!!.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL)
        progressDialog!!.isIndeterminate = false
        progressDialog!!.setCanceledOnTouchOutside(false)
        progressDialog!!.setButton(DialogInterface.BUTTON_NEGATIVE, "Cancel") { dialog, which -&amp;gt;
            downloadMsg!!.visibility = View.GONE
            mGraphicsOverlay!!.graphics.clear()
            mapdownloadJob!!.cancel()
            //set the flag to false to re-select the download area for consecutive downloads
            isMapDownloadAreaSelected = false
            isMapDownloadInProgress = false
            dialog.dismiss()
        }
        if (!isMapDownloadAreaSelected) {
            downloadMsg!!.visibility = View.VISIBLE
            // create a graphics overlay for the map view
            mGraphicsOverlay = GraphicsOverlay()
            mapView!!.graphicsOverlays.add(mGraphicsOverlay)

            // create a graphic to show a box around the extent we want to download
            mDownloadArea = Graphic()
            mGraphicsOverlay!!.graphics.add(mDownloadArea)
            val simpleLineSymbol = SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, Color.RED, 2F)
            mDownloadArea!!.symbol = simpleLineSymbol
            // upper left corner of the area to take offline
            minScreenPoint = Point(200, 200)
            // lower right corner of the downloaded area
            maxScreenPoint = Point(mapView!!.width - 200,
                    mapView!!.height - 200)
            // convert screen points to map points
            minPoint = mapView!!.screenToLocation(minScreenPoint)
            maxPoint = mapView!!.screenToLocation(maxScreenPoint)
            // use the points to define and return an envelope
            if (minPoint != null &amp;amp;&amp;amp; maxPoint != null) {
                val envelope = Envelope(minPoint, maxPoint)
                mDownloadArea!!.geometry = envelope
            }

            //Debugging - use this to get errors with layers and tables

            var offlineMapTask = OfflineMapTask(map);
            var minScale = mapView!!.mapScale
            val maxScale = mapView!!.map.maxScale
            val generateOfflineMapParameters = GenerateOfflineMapParameters(mDownloadArea!!.geometry, minScale, maxScale)

            val offlineMapCapabilitiesFuture: ListenableFuture&amp;lt;OfflineMapCapabilities&amp;gt; = offlineMapTask.getOfflineMapCapabilitiesAsync(generateOfflineMapParameters)
            offlineMapCapabilitiesFuture.addDoneListener {
                    val offlineMapCapabilities: OfflineMapCapabilities = offlineMapCapabilitiesFuture.get()
                    if (offlineMapCapabilities.hasErrors()) {
                        // Handle possible errors with layers
                        for ((key, value) in offlineMapCapabilities.getLayerCapabilities()) {
                            if (!value.isSupportsOffline()) {
                                println(key.getName().toString() + " cannot be taken offline\n" +
                                        "Error: " + value.getError())
                            }
                        }

                        // Handle possible errors with tables
                        for ((key, value) in offlineMapCapabilities.getTableCapabilities()) {
                            if (!value.isSupportsOffline()) {
                                println(key.tableName.toString() + " cannot be taken offline\n" +
                                        "Error : " + value.getError())
                            }
                        }
                    } else {
                        // All layers and tables can be taken offline!
                        showMessage("All layers are good to go!")
                    }
            }

            //End Debugging

            // update the download area box whenever the viewpoint changes
            mapView!!.addViewpointChangedListener { viewpointChangedEvent: ViewpointChangedEvent? -&amp;gt;
                if (map!!.loadStatus == LoadStatus.LOADED) {
                    // upper left corner of the area to take offline
                    minScreenPoint = Point(200, 200)
                    // lower right corner of the downloaded area
                    maxScreenPoint = Point(mapView!!.width - 200,
                            mapView!!.height - 200)
                    // convert screen points to map points
                    minPoint = mapView!!.screenToLocation(minScreenPoint)
                    maxPoint = mapView!!.screenToLocation(maxScreenPoint)
                    // use the points to define and return an envelope
                    if (minPoint != null &amp;amp;&amp;amp; maxPoint != null) {
                        val envelope = Envelope(minPoint, maxPoint)
                        mDownloadArea!!.geometry = envelope
                    }
                }
            }
            // map download area selected
            isMapDownloadAreaSelected = true
        } else {
            if (!isMapDownloadInProgress) {
                progressDialog!!.progress = 0
                progressDialog!!.show()

                // delete any offline map already in the cache
                deleteDirectory(File(offlineMapDirectoryPath))
                // specify the extent, min scale, and max scale as parameters
                var minScale = mapView!!.mapScale
                val maxScale = mapView!!.map.maxScale
                // minScale must always be larger than maxScale
                if (minScale &amp;lt;= maxScale) {
                    minScale = maxScale + 1
                }
                val generateOfflineMapParameters = GenerateOfflineMapParameters(mDownloadArea!!.geometry, minScale, maxScale)
                // create an offline map offlineMapTask with the map
                val offlineMapTask = OfflineMapTask(mapView!!.map)

                // create an offline map job with the download directory path and parameters and start the job
                mapdownloadJob = offlineMapTask.generateOfflineMap(generateOfflineMapParameters, offlineMapDirectoryPath)
                isMapDownloadInProgress = true
                // replace the current map with the result offline map when the job finishes
                mapdownloadJob.addJobDoneListener(Runnable {
                    if (mapdownloadJob.getStatus() == Job.Status.SUCCEEDED) {
                        val result = mapdownloadJob.getResult()
                        downloadMsg!!.visibility = View.GONE
                        mGraphicsOverlay!!.graphics.clear()
                        //set the flag to false to re-select the download area for consecutive downloads
                        isMapDownloadAreaSelected = false
                        isMapDownloadInProgress = false

                        //show the map
                        mapView!!.map = result.offlineMap

                        //hide save map, show cancel map
                        //save_map.visibility = View.GONE
                        //cancel_map.visibility = View.VISIBLE

                        //hide the legend - it must be online
                        legendHeader!!.visibility = View.GONE

                        if (mAttributes != null) {
                            sharedPreferencesPseg.setString("ESDNUMBERFORSAVEDMAP", mAttributes!!.cadjobno)
                        } else {
                            sharedPreferencesPseg.setString("ESDNUMBERFORSAVEDMAP", "MAINTAB")
                        }

                        Toast.makeText(requireContext(), "Map downloaded successfully", Toast.LENGTH_LONG).show()
                    } else if (mapdownloadJob.getStatus() == Job.Status.FAILED) {
                        Toast.makeText(requireContext(), "Error in generate offline map", Toast.LENGTH_LONG).show()
                    } else if (mapdownloadJob.getStatus() == Job.Status.PAUSED) {
                        Toast.makeText(requireContext(), "Map download cancelled", Toast.LENGTH_LONG).show()
                    }
                    progressDialog!!.dismiss()
                })
                mapdownloadJob.addProgressChangedListener(Runnable { progressDialog!!.progress = mapdownloadJob.getProgress() })
                mapdownloadJob.start()
            } else {
                mapdownloadJob!!.addProgressChangedListener { progressDialog!!.progress = mapdownloadJob!!.progress }
                progressDialog!!.show()
            }
        }
    }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; When the code to display the map is called the map is displayed but with minimal detail and it appears layer(s) are left out. &amp;nbsp;I'm not sure what is causing this. &amp;nbsp;I also use this function below to open the map and wanted to provide this to see if there are errors in this code as well:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="kotlin"&gt;    private fun openOfflineMap() {
        val offlineMapPackage = MobileMapPackage(offlineMapDirectoryPath)
        offlineMapPackage.loadAsync()
        offlineMapPackage.addDoneLoadingListener {
            if (offlineMapPackage.maps.size == 0) {
                mapNotDownloadedMsg!!.visibility = View.VISIBLE
                progressBar!!.visibility = View.GONE
            } else {
                mapView!!.map = offlineMapPackage.maps[0]
                callout = mapView!!.callout
                progressBar!!.visibility = View.GONE
                //                    downloadMapIcon.setVisibility(View.GONE);
                mapView!!.visibility = View.VISIBLE
                mapView!!.onTouchListener = object : DefaultMapViewOnTouchListener(context, mapView) {
                    override fun onSingleTapConfirmed(e: MotionEvent): Boolean {
                        if (callout.isShowing()) {
                            callout.dismiss()
                        }
                        val screenPoint = Point(Math.round(e.x), Math.round(e.y))
                        // identifyResult(screenPoint);
                        identifyandDisplayResults(screenPoint)
                        return true
                    }
                }
            }
        }
    }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help you can provide is much appreciated! &amp;nbsp;If there is a need for additional detail please let me know and I will provide as best I can.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;John Meah&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jan 2021 22:12:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/offline-map-doesn-t-show-all-layers/m-p/1014891#M35786</guid>
      <dc:creator>JohnMeah</dc:creator>
      <dc:date>2021-01-07T22:12:12Z</dc:date>
    </item>
  </channel>
</rss>

