do { print("\(locations[0].coordinate.longitude)","\(locations[0].coordinate.latitude)") let trafficSpeedLayer = TrafficSpeedLayer(url: URL(string: Constants.DARB_FEATURE_SERVICE_TRAFFIC_SPEED), mode: .selection, credential: self.layerCredentials) trafficSpeedLayer?.name = "trafficSpeedLayer" trafficSpeedLayer?.point = point trafficSpeedLayer?.trafficSpeedDelegate = self let isPresent = MapUtils.isLayerPresent(mapLayers: self.mapView.mapLayers, targetLayer: trafficSpeedLayer!) if !isPresent { self.mapView.addMapLayer(trafficSpeedLayer) print("adding layer to map") } else { self.mapView.removeMapLayer(withName: "trafficSpeedLayer") print("removing layer from map") }