<?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 Re: How to use ENCMarinerSettings to set depth units with iOS/Swift in ArcGIS Runtime SDK for iOS Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-use-encmarinersettings-to-set-depth-units/m-p/1370045#M7705</link>
    <description>&lt;P&gt;Hi Chris,&lt;/P&gt;&lt;P&gt;I'm sure it's staring us both in the face.&lt;/P&gt;&lt;P&gt;What's up with that line 18 of code?&amp;nbsp;&amp;nbsp;&lt;EM&gt;let depthUnits = AGSENCMarinerSettings.shared()&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Have you run the code for errors?&lt;/P&gt;</description>
    <pubDate>Mon, 15 Jan 2024 00:32:14 GMT</pubDate>
    <dc:creator>RonaldHaug</dc:creator>
    <dc:date>2024-01-15T00:32:14Z</dc:date>
    <item>
      <title>How to use ENCMarinerSettings to set depth units with iOS/Swift</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-use-encmarinersettings-to-set-depth-units/m-p/1370021#M7701</link>
      <description>&lt;P&gt;Can someone help me set the depth units to feet? Here's my code, I am displaying the ENC chart successfully.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="swift"&gt;import SwiftUI
import ArcGIS

struct ContentView: View {
    @State private var map = AGSMap(basemapStyle: .arcGISOceans)

    var body: some View {
        MapView(map: map)
            .edgesIgnoringSafeArea(.all)
            .onAppear {
                map.initialViewpoint = AGSViewpoint(latitude: 45.318063, longitude: -85.2584, scale: 30055)
                loadENCExchangeSet()
            }
    }

    private func loadENCExchangeSet() {
        
        let depthUnits = AGSENCMarinerSettings.shared()
        

        // Load ENC Exchange Set
        if let catalogURL = Bundle.main.url(forResource: "CATALOG", withExtension: "031", subdirectory: "/ENC_ROOT") {
            let encExchangeSet = AGSENCExchangeSet(fileURLs: [catalogURL])
            
            encExchangeSet.load { error in
                if let error = error {
                    print("Error loading ENC Exchange Set: \(error.localizedDescription)")
                } else {
                    
                    let encLayers = encExchangeSet.datasets.map { AGSENCLayer(cell: AGSENCCell(dataset: $0)) }
                    DispatchQueue.main.async {
                        self.map.operationalLayers.addObjects(from: encLayers)
                        // Adjust this viewpoint to match where your ENC data is
                        self.map.initialViewpoint = AGSViewpoint(latitude: 45.318063, longitude: -85.2584, scale: 30055)
                    }
                }
            }
        } else {
            print("Error: CATALOG.031 file not found in bundle.")
        }
    }

}

struct MapView: UIViewRepresentable {
    let map: AGSMap
    let graphicsOverlay = AGSGraphicsOverlay()

    func makeUIView(context: Context) -&amp;gt; AGSMapView {
        let mapView = AGSMapView()
        mapView.map = map
        mapView.graphicsOverlays.add(graphicsOverlay)
        return mapView
    }

    func updateUIView(_ uiView: AGSMapView, context: Context) {
        // Perform any necessary updates to the UIView
    }

}


struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 14 Jan 2024 16:23:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-use-encmarinersettings-to-set-depth-units/m-p/1370021#M7701</guid>
      <dc:creator>ChrisPelon</dc:creator>
      <dc:date>2024-01-14T16:23:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to use ENCMarinerSettings to set depth units with iOS/Swift</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-use-encmarinersettings-to-set-depth-units/m-p/1370023#M7702</link>
      <description>&lt;P&gt;I have this line, but does not seem to work.&amp;nbsp; colorScheme is working, but not displayDepthUnits.&lt;/P&gt;&lt;LI-CODE lang="swift"&gt;// Set up ENC environment
        let hydrographyDirectory = Bundle.main.url(forResource: "S57DataDictionary", withExtension: "xml", subdirectory: "hydrography")!.deletingLastPathComponent()
        let environmentSettings = AGSENCEnvironmentSettings.shared()
        environmentSettings.resourceDirectory = hydrographyDirectory
        environmentSettings.sencDataDirectory = FileManager.default.temporaryDirectory
        
        environmentSettings.displaySettings.marinerSettings.displayDepthUnits = .feet
        
        environmentSettings.displaySettings.marinerSettings.colorScheme = .day&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 14 Jan 2024 18:14:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-use-encmarinersettings-to-set-depth-units/m-p/1370023#M7702</guid>
      <dc:creator>ChrisPelon</dc:creator>
      <dc:date>2024-01-14T18:14:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to use ENCMarinerSettings to set depth units with iOS/Swift</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-use-encmarinersettings-to-set-depth-units/m-p/1370042#M7703</link>
      <description>&lt;P&gt;Hi Chris,&lt;/P&gt;&lt;P&gt;I may be out of my depth here, but I recommend you google "ENCMarinerSettings".&lt;/P&gt;&lt;P&gt;From the listings:&lt;/P&gt;&lt;P data-unlink="true"&gt;1) ArcGIS delevopers has&amp;nbsp;&lt;A href="https://developers.arcgis.com/net/api-reference/api/uwp/Hydrography/Esri.ArcGISRuntime.Hydrography.EncMarinerSettings.html" target="_self"&gt;Class EncMarinerSettings&lt;/A&gt;&amp;nbsp;.&amp;nbsp;Checking the ClassEncMariner Settings, color scheme default is day, so I don't know whether your coding is steering the ship.&lt;/P&gt;&lt;P data-unlink="true"&gt;2) There is a post similar to yours posted in Esri Community "&lt;A href="https://community.esri.com/t5/qt-maps-sdk-questions/issue-with-encdisplaysettings-in-arcgis-runtime/td-p/1368186" target="_self"&gt;Issue with 'EncDisplaySettings' in ArcGIS Runtime SDK for Qt&lt;/A&gt;" . This one the answer is solved by starting with #include "EncDisplaySettings.h" in the code.&lt;/P&gt;&lt;P data-unlink="true"&gt;Hope this leads you a bit further down the path to solving your coding and getting your display panel operating the way you want it to. What's a pirate's favorite letter? "Aaaaarrrgh"&lt;/P&gt;</description>
      <pubDate>Sun, 14 Jan 2024 23:13:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-use-encmarinersettings-to-set-depth-units/m-p/1370042#M7703</guid>
      <dc:creator>RonaldHaug</dc:creator>
      <dc:date>2024-01-14T23:13:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to use ENCMarinerSettings to set depth units with iOS/Swift</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-use-encmarinersettings-to-set-depth-units/m-p/1370043#M7704</link>
      <description>&lt;P&gt;Hi Ron,&lt;/P&gt;&lt;P&gt;Thanks for taking a look. EncMarinerSettings.colorscheme is working well. I can switch between day/dusk/night. What is not working is&amp;nbsp;EncMarinerSettings.displayDepthUnits. No matter what I do, the chart always shows depths in meters. I have searched online for many hours and even went round and round with chatGPT &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; to no avail. Must be something simple I am missing.&lt;/P&gt;</description>
      <pubDate>Sun, 14 Jan 2024 23:32:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-use-encmarinersettings-to-set-depth-units/m-p/1370043#M7704</guid>
      <dc:creator>ChrisPelon</dc:creator>
      <dc:date>2024-01-14T23:32:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to use ENCMarinerSettings to set depth units with iOS/Swift</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-use-encmarinersettings-to-set-depth-units/m-p/1370045#M7705</link>
      <description>&lt;P&gt;Hi Chris,&lt;/P&gt;&lt;P&gt;I'm sure it's staring us both in the face.&lt;/P&gt;&lt;P&gt;What's up with that line 18 of code?&amp;nbsp;&amp;nbsp;&lt;EM&gt;let depthUnits = AGSENCMarinerSettings.shared()&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Have you run the code for errors?&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jan 2024 00:32:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-use-encmarinersettings-to-set-depth-units/m-p/1370045#M7705</guid>
      <dc:creator>RonaldHaug</dc:creator>
      <dc:date>2024-01-15T00:32:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to use ENCMarinerSettings to set depth units with iOS/Swift</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-use-encmarinersettings-to-set-depth-units/m-p/1370223#M7706</link>
      <description>&lt;P&gt;I've removed line 18 since I posted the code, I was just playing with ways to get displayDepthUnits to work.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jan 2024 16:33:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-use-encmarinersettings-to-set-depth-units/m-p/1370223#M7706</guid>
      <dc:creator>ChrisPelon</dc:creator>
      <dc:date>2024-01-15T16:33:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to use ENCMarinerSettings to set depth units with iOS/Swift</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-use-encmarinersettings-to-set-depth-units/m-p/1370595#M7707</link>
      <description>&lt;P&gt;This line in your code should do it:&lt;/P&gt;&lt;PRE&gt;        environmentSettings.displaySettings.marinerSettings.displayDepthUnits = .feet&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One of my colleagues is going to check to see if we have a bug here. I can get back to you after that.&lt;/P&gt;&lt;P&gt;Also, I see that you are using our 100.x SDK and using it with SwiftUI. Is there a reason why you haven't migrated to our 200 series with the Swift SDK? It has out of the box support for SwiftUI:&amp;nbsp;&lt;A href="https://developers.arcgis.com/swift/" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/swift/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2024 17:25:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-use-encmarinersettings-to-set-depth-units/m-p/1370595#M7707</guid>
      <dc:creator>rolson_esri</dc:creator>
      <dc:date>2024-01-16T17:25:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to use ENCMarinerSettings to set depth units with iOS/Swift</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-use-encmarinersettings-to-set-depth-units/m-p/1370654#M7708</link>
      <description>&lt;P&gt;Also,&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/754548"&gt;@ChrisPelon&lt;/a&gt;,&amp;nbsp;what version of 100.x are you using?&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2024 19:02:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-use-encmarinersettings-to-set-depth-units/m-p/1370654#M7708</guid>
      <dc:creator>rolson_esri</dc:creator>
      <dc:date>2024-01-16T19:02:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to use ENCMarinerSettings to set depth units with iOS/Swift</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-use-encmarinersettings-to-set-depth-units/m-p/1370774#M7709</link>
      <description>&lt;P&gt;Thank you for pointing out I was not using 200. I have updated to 200 sdk. but now this code does not work.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="swift"&gt;private func loadENCExchangeSet() {
        // Load ENC Exchange Set
        if let catalogURL = Bundle.main.url(forResource: "CATALOG", withExtension: "031", subdirectory: "/ENC_ROOT") {
            let encExchangeSet = ENCExchangeSet(fileURLs: [catalogURL])

            encExchangeSet.load { error in
                if let error = error {
                    print("Error loading ENC Exchange Set: \(error.localizedDescription)")
                } else {
                    let encLayers = encExchangeSet.datasets.map { ENCLayer(cell: ENCCell(dataset: $0)) }
                    
                    DispatchQueue.main.async {
// I am getting error here
                        self.map.operationalLayers.addObjects(from: encLayers)
                        print("ENC layers added to the map.")
                    }
                }
            }
        } else {
            print("Error: CATALOG.031 file not found in bundle.")
        }
    }&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 16 Jan 2024 23:44:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-use-encmarinersettings-to-set-depth-units/m-p/1370774#M7709</guid>
      <dc:creator>ChrisPelon</dc:creator>
      <dc:date>2024-01-16T23:44:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to use ENCMarinerSettings to set depth units with iOS/Swift</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-use-encmarinersettings-to-set-depth-units/m-p/1370776#M7710</link>
      <description>&lt;P&gt;Why are you using a dispatch async to add the operational layers? I don't think you need to do that. Nevertheless, I don't think that should be an issue. What error are you seeing or what is failing?&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2024 23:49:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-use-encmarinersettings-to-set-depth-units/m-p/1370776#M7710</guid>
      <dc:creator>rolson_esri</dc:creator>
      <dc:date>2024-01-16T23:49:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to use ENCMarinerSettings to set depth units with iOS/Swift</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-use-encmarinersettings-to-set-depth-units/m-p/1370778#M7711</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-01-16 at 6.51.46 PM.png" style="width: 822px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/91772i9C80E5E14CA5E0C8/image-dimensions/822x272?v=v2" width="822" height="272" role="button" title="Screenshot 2024-01-16 at 6.51.46 PM.png" alt="Screenshot 2024-01-16 at 6.51.46 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2024 23:52:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-use-encmarinersettings-to-set-depth-units/m-p/1370778#M7711</guid>
      <dc:creator>ChrisPelon</dc:creator>
      <dc:date>2024-01-16T23:52:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to use ENCMarinerSettings to set depth units with iOS/Swift</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-use-encmarinersettings-to-set-depth-units/m-p/1370783#M7712</link>
      <description>&lt;P&gt;The API has changed. Load doesn't take a completion block like the 100 SDK. The Swift SDK was redesigned from the ground up to take advantage of all the features of swift, including Swift Concurrency. &amp;nbsp;That means that loading an exchange set is now an async method:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="swift"&gt;try await encExchangeSet.load()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;adding operational layers is also different. There are add methods directly on the map (see doc &lt;A href="https://developers.arcgis.com/swift/api-reference/documentation/arcgis/geomodel/addoperationallayers(_:)" target="_self"&gt;here&lt;/A&gt;) .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So that code should probably look something like:&lt;/P&gt;&lt;LI-CODE lang="swift"&gt;self.map.addOperationalLayers(encLayers)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jan 2024 00:01:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-use-encmarinersettings-to-set-depth-units/m-p/1370783#M7712</guid>
      <dc:creator>rolson_esri</dc:creator>
      <dc:date>2024-01-17T00:01:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to use ENCMarinerSettings to set depth units with iOS/Swift</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-use-encmarinersettings-to-set-depth-units/m-p/1370784#M7713</link>
      <description>&lt;P&gt;BTW, as you migrate from 100 to 200 here is a doc that might help:&amp;nbsp;&lt;A href="https://developers.arcgis.com/swift/reference/migrate-from-100-x-to-200-x/" target="_blank"&gt;https://developers.arcgis.com/swift/reference/migrate-from-100-x-to-200-x/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jan 2024 00:02:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-use-encmarinersettings-to-set-depth-units/m-p/1370784#M7713</guid>
      <dc:creator>rolson_esri</dc:creator>
      <dc:date>2024-01-17T00:02:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to use ENCMarinerSettings to set depth units with iOS/Swift</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-use-encmarinersettings-to-set-depth-units/m-p/1370790#M7714</link>
      <description>&lt;P&gt;Thank you! This was the info I needed.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jan 2024 00:18:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-use-encmarinersettings-to-set-depth-units/m-p/1370790#M7714</guid>
      <dc:creator>ChrisPelon</dc:creator>
      <dc:date>2024-01-17T00:18:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to use ENCMarinerSettings to set depth units with iOS/Swift</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-use-encmarinersettings-to-set-depth-units/m-p/1370791#M7715</link>
      <description>&lt;P&gt;Can you please let me know if the depth units still don't work for you after you migrate your code? Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jan 2024 00:20:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-use-encmarinersettings-to-set-depth-units/m-p/1370791#M7715</guid>
      <dc:creator>rolson_esri</dc:creator>
      <dc:date>2024-01-17T00:20:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to use ENCMarinerSettings to set depth units with iOS/Swift</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-use-encmarinersettings-to-set-depth-units/m-p/1370794#M7716</link>
      <description>&lt;P&gt;Depth units are now working as expected in 200 and the updated code. Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jan 2024 00:26:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-use-encmarinersettings-to-set-depth-units/m-p/1370794#M7716</guid>
      <dc:creator>ChrisPelon</dc:creator>
      <dc:date>2024-01-17T00:26:14Z</dc:date>
    </item>
  </channel>
</rss>

