Can someone help me set the depth units to feet? Here's my code, I am displaying the ENC chart successfully.
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) -> 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()
}
}